hyperv-daemons/hpvd-vmbus_testing-fix-wrong-python-syntax-for-integer-va.patch
Miroslav Rezanina d9314ddbc8 * Thu Jun 27 2024 Miroslav Rezanina <mrezanin@redhat.com> - 0-1.45.20220731git
- hpvd-Add-support-for-patching-hyperv-daemons.patch [RHEL-40107 RHEL-40679]
- hpvd-Do-not-set-NM_CONTROLLED-no.patch [RHEL-40107 RHEL-40679]
- hpvd-Add-vmbus_testing-tool-build-files.patch [RHEL-40107 RHEL-40679]
- hpvd-hv_set_ifconfig.sh-Use-nmcli-commands.patch [RHEL-40107 RHEL-40679]
- hpvd-Use-filename-for-connection-profile.patch [RHEL-40107 RHEL-40679]
- hpvd-redhat-hv_set_if_config-Workaround-for-gateway-numbe.patch [RHEL-40107 RHEL-40679]
- hpvd-tools-hv-Remove-an-extraneous-the.patch [RHEL-40107 RHEL-40679]
- hpvd-tools-hv-kvp-remove-unnecessary-void-conversions.patch [RHEL-40107 RHEL-40679]
- hpvd-vmbus_testing-fix-wrong-python-syntax-for-integer-va.patch [RHEL-40107 RHEL-40679]
- hpvd-hv-hv_kvp_daemon-Support-for-keyfile-based-connectio.patch [RHEL-40107 RHEL-40679]
- hpvd-hv-hv_kvp_daemon-Some-small-fixes-for-handling-NM-ke.patch [RHEL-40107 RHEL-40679]
- hpvd-hv-hv_kvp_daemon-Handle-IPv4-and-Ipv6-combination-fo.patch [RHEL-40107 RHEL-40679]
- hpvd-Changes-for-adding-keyfile-support-in-RHEL-specific-.patch [RHEL-40107 RHEL-40679]
- hpvd-Remove-hyperv_fcopy_daemon-as-the-c10s-kernel-does-n.patch [RHEL-40107 RHEL-40679]
- Resolves: RHEL-40107
  ([Hyper-V][RHEL10] Request to update hypervkvpd related file /usr/libexec/hypervkvpd/hv_set_ifconfig same as RHEL 9.5 hv_set_ifconfig file.)
- Resolves: RHEL-40679
  ([Hyper-V][RHEL10] Request to update hyperv-daemons vmbus_testing, hv_kvp_daemon.c, hv_vss_daemon.c files as same as RHEL 9.5)
2024-06-27 02:15:00 -04:00

56 lines
2.1 KiB
Diff

From 520bfb6b8bc7cedc2dcb602a708c1357faf638b8 Mon Sep 17 00:00:00 2001
From: Ani Sinha <anisinha@redhat.com>
Date: Wed, 5 Jul 2023 18:44:34 +0530
Subject: [PATCH 09/14] vmbus_testing: fix wrong python syntax for integer
value comparison
RH-Author: Miroslav Rezanina <mrezanin@redhat.com>
RH-MergeRequest: 9: Synchronize RHEL 9 changes to RHEL 10
RH-Jira: RHEL-40107 RHEL-40679
RH-Acked-by: Ani Sinha <anisinha@redhat.com>
RH-Commit: [9/14] 261dfeef254265a966e7175766f366eaed782454 (mrezanin/centos-git-hyperv-daemons)
It is incorrect in python to compare integer values using the "is" keyword. The
"is" keyword in python is used to compare references to two objects, not their
values. Newer version of python3 (version 3.8) throws a warning when such
incorrect comparison is made. For value comparison, "==" should be used.
Fix this in the code and suppress the following warning:
/usr/sbin/vmbus_testing:167: SyntaxWarning: "is" with a literal. Did you mean "=="?
Signed-off-by: Ani Sinha <anisinha@redhat.com>
patch_name: hpvd-vmbus_testing-fix-wrong-python-syntax-for-integer-va.patch
present_in_specfile: true
location_in_specfile: 12
---
vmbus_testing | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/vmbus_testing b/vmbus_testing
index e721290..4467979 100755
--- a/vmbus_testing
+++ b/vmbus_testing
@@ -164,7 +164,7 @@ def recursive_file_lookup(path, file_map):
def get_all_devices_test_status(file_map):
for device in file_map:
- if (get_test_state(locate_state(device, file_map)) is 1):
+ if (get_test_state(locate_state(device, file_map)) == 1):
print("Testing = ON for: {}"
.format(device.split("/")[5]))
else:
@@ -203,7 +203,7 @@ def write_test_files(path, value):
def set_test_state(state_path, state_value, quiet):
write_test_files(state_path, state_value)
- if (get_test_state(state_path) is 1):
+ if (get_test_state(state_path) == 1):
if (not quiet):
print("Testing = ON for device: {}"
.format(state_path.split("/")[5]))
--
2.39.3