filter_results matches substrings without wildcards leading to false positives when evaluating arguments, e.g foo matches foo, foo1, foo2... when only "foo*" should match the substring matches --- spacecmd/src/lib/utils.py | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/spacecmd/src/lib/utils.py b/spacecmd/src/lib/utils.py index 2ee4c4e..c390644 100644 --- a/spacecmd/src/lib/utils.py +++ b/spacecmd/src/lib/utils.py @@ -110,7 +110,11 @@ def filter_results(items, patterns, search = False): compiled_patterns = [] for pattern in patterns: - compiled_patterns.append(re.compile(pattern, re.I)) + if search: + compiled_patterns.append(re.compile(pattern, re.I)) + else: + # If in "match" mode, we don't want to match substrings + compiled_patterns.append(re.compile("^"+pattern+"$", re.I)) for item in items: for pattern in compiled_patterns: -- 1.7.1 _______________________________________________ Spacewalk-devel mailing list Spacewalk-devel@redhat.com https://www.redhat.com/mailman/listinfo/spacewalk-devel