Commit 04ccf99b authored by Andrey Vertiprahov's avatar Andrey Vertiprahov
Browse files

Merge branch 'fix_matcher' into 'master'

Fix matcher parsing

See merge request !2501
parents f085a815 1107cbf4
Pipeline #15665 canceled with stages
......@@ -37,6 +37,8 @@ def match(ctx, expr):
return False
if isinstance(expr[x], dict):
for m in expr[x]:
if ctx[x] is None:
mf = matchers.get(m)
if mf and not isinstance(expr[x][m], tuple):
if not mf(ctx[x], expr[x][m]):
......@@ -49,6 +49,12 @@ def test_eq_and(raw, config, expected):
{"platform": {"$regex": "^S"}, "vendor": "Dell"},
{"vendor": "Eltex", "image": "_image.bin"},
{"image": {"$regex": r"^\S+"}, "vendor": "Eltex"},
({"vendor": "Eltex"}, {"image": {"$regex": r"^\S+"}, "vendor": "Eltex"}, False),
def test_regex(raw, config, expected):
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment