Patchworkβ [KVM-AUTOTEST,6/7] KVM test: kvm_config.py: match(): put filter inside parentheses

login
register
about
Submitter Michael Goldish
Date 2009-11-05 10:01:11
Message ID <1257415272-9423-6-git-send-email-mgoldish@redhat.com>
Download mbox | patch
Permalink /patch/57866/
State New
Headers show

Comments

Michael Goldish - 2009-11-05 10:01:11
This solves problems due to operator precedence (such as virtio|e1000 matching
nic_e1000 even though it shouldn't).

Signed-off-by: Michael Goldish <mgoldish@redhat.com>
---
 client/tests/kvm/kvm_config.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Patch

diff --git a/client/tests/kvm/kvm_config.py b/client/tests/kvm/kvm_config.py
index 52de4c7..649f2c3 100755
--- a/client/tests/kvm/kvm_config.py
+++ b/client/tests/kvm/kvm_config.py
@@ -83,7 +83,7 @@  class config:
         @param filter: A regular expression that defines the filter.
         @param dict: Dictionary that will be inspected.
         """
-        filter = re.compile(r"(\.|^)" + filter + r"(\.|$)")
+        filter = re.compile(r"(\.|^)(%s)(\.|$)" % filter)
         return bool(filter.search(dict["name"]))