KVM Test: Add re.IGNORECASE to re.compile to verify_ip_address_ in kvm_utils.py
A message that is not in the archive (sent off-list or not yet received): 1162344679.1122961256714375025.JavaMail.root@zmail05.collab.prod.int.phx2.redhat.com
Thanks for catching this.
While we're at it, why not remove the 2 occurrences of re.IGNORECASE that have no effect?
We can also replace re.search(regex, o) with the slightly shorter regex.search(o), but that's just a cosmetic change.
----- Original Message -----
From: "Chen Cao" <[email protected]>
To: [email protected], [email protected]
Cc: [email protected], "Chen Cao" <[email protected]>
Sent: Tuesday, October 27, 2009 6:03:36 AM (GMT+0200) Auto-Detected
Subject: [PATCH] KVM Test: Add re.IGNORECASE to re.compile to verify_ip_address_ in kvm_utils.py
Since the mac address is (changed to) lowercase and the output of 'arping' is in uppercase, we need re.IGNORECASE in the re.compile.
(the re.IGNORECASE in the re.search function takes no effect on the compiled regex.)
--- client/tests/kvm/kvm_utils.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
client/tests/kvm/kvm_utils.py +1 -1
@@ -190,7 +190,7 @@ def verify_ip_address_ownership(ip, macs, timeout=10.0): # Compile a regex that matches the given IP address and any of the given # MAC addresses mac_regex = "|".join("(%s)" % mac for mac in macs) - regex = re.compile(r"\b%s\b.*\b(%s)\b" % (ip, mac_regex)) + regex = re.compile(r"\b%s\b.*\b(%s)\b" % (ip, mac_regex), re.IGNORECASE) # Check the ARP cache o = commands.getoutput("/sbin/arp -n")
Signature · 6 lines
1.6.0.6 -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 3 lines · Michael Goldish
Thanks for catching this.
While we're at it, why not remove the 2 occurrences of re.IGNORECASE that have no effect?
I just chose to ignore the code that does not break the tests.
I'd like to send a patch to remove the 2 're.IGNORECASE's and use regex.search(o), as you recommended, to let Lucas to decide the perferred way to fix. :-)
Thanks for your advice.
Cao, Chen
2009/10/28
Quoted 48 lines
We can also replace
re.search(regex, o)with the slightly shorterregex.search(o), but that's just a cosmetic change.----- Original Message -----
From: "Chen Cao" <[email protected]>
To: [email protected], [email protected]
Cc: [email protected], "Chen Cao" <[email protected]>
Sent: Tuesday, October 27, 2009 6:03:36 AM (GMT+0200) Auto-Detected
Subject: [PATCH] KVM Test: Add re.IGNORECASE to re.compile toverify_ip_address_inkvm_utils.pySince the mac address is (changed to) lowercase and the output of 'arping' is in uppercase, we need re.IGNORECASE in the re.compile.
(the re.IGNORECASE in the re.search function takes no effect on the compiled regex.)
Signed-off-by Cao, Chen <[email protected]>--- client/tests/kvm/kvm_utils.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)client/tests/kvm/kvm_utils.py +1
-1@@ -190,7 +190,7 @@ def verify_ip_address_ownership(ip, macs, timeout=10.0): # Compile a regex that matches the given IP address and any of the given # MAC addresses mac_regex = "|".join("(%s)" % mac for mac in macs) - regex = re.compile(r"\b%s\b.*\b(%s)\b" % (ip, mac_regex)) + regex = re.compile(r"\b%s\b.*\b(%s)\b" % (ip, mac_regex), re.IGNORECASE) # Check the ARP cache o = commands.getoutput("/sbin/arp -n")Signature · 10 lines
1.6.0.6 -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Thanks guys, applied!
Quoted 69 lines · Chen
Quoted 3 lines · Michael Goldish
Thanks for catching this.
While we're at it, why not remove the 2 occurrences of re.IGNORECASE that have no effect?I just chose to ignore the code that does not break the tests.
I'd like to send a patch to remove the 2 're.IGNORECASE's and use
regex.search(o), as you recommended, to let Lucas to decide the perferred way to fix. :-)Thanks for your advice.
Cao, Chen
2009/10/28Quoted 40 lines
We can also replace
re.search(regex, o)with the slightly shorterregex.search(o), but that's just a cosmetic change.----- Original Message -----
From: "Chen Cao" <[email protected]>
To: [email protected], [email protected]
Cc: [email protected], "Chen Cao" <[email protected]>
Sent: Tuesday, October 27, 2009 6:03:36 AM (GMT+0200) Auto-Detected
Subject: [PATCH] KVM Test: Add re.IGNORECASE to re.compile toverify_ip_address_inkvm_utils.pySince the mac address is (changed to) lowercase and the output of 'arping' is in uppercase, we need re.IGNORECASE in the re.compile.
(the re.IGNORECASE in the re.search function takes no effect on the compiled regex.)
Signed-off-by Cao, Chen <[email protected]>---
client/tests/kvm/kvm_utils.py | 2 +-1 files changed, 1 insertions(+), 1 deletions(-)client/tests/kvm/kvm_utils.py +1
-2@@ -190,7 +190,7 @@ def verify_ip_address_ownership(ip, macs, timeout=10.0): # Compile a regex that matches the given IP address and any of the given # MAC addresses mac_regex = "|".join("(%s)" % mac for mac in macs) - regex = re.compile(r"\b%s\b.*\b(%s)\b" % (ip, mac_regex)) + regex = re.compile(r"\b%s\b.*\b(%s)\b" % (ip, mac_regex), re.IGNORECASE) # Check the ARP cache o = commands.getoutput("/sbin/arp -n") --1.6.0.6
Quoted 8 lines
--
To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html_______________________________________________
Autotest mailing list
[email protected]
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest
Signature · 1 line
Lucas