Skip to content

Commit

Permalink
fix(gathered_filter): Fix error handling for no-value operators (#489)
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesholland-uk authored Sep 14, 2023
1 parent 2b22d68 commit 351960c
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion plugins/module_utils/panos.py
Original file line number Diff line number Diff line change
Expand Up @@ -1201,14 +1201,24 @@ def matches_gathered_filter(self, item, logic):
except StopIteration:
raise Exception(err_msg)

operator_list = operator.split(")")
operator = operator_list[0]
if operator == "is-none":
evaler.append("{0}".format(item_config[field] is None))
elif operator == "is-not-none":
evaler.append("{0}".format(item_config[field] is not None))
elif operator == "is-true":
evaler.append("{0}".format(bool(item_config[field])))
elif operator == "is-false":
evaler.append("{0}".format(bool(not item_config[field])))
evaler.append("{0}".format(not bool(item_config[field])))

if operator in ["is-none", "is-not-none", "is-true", "is-false"]:
evaler.extend(")" * (len(operator_list) - 1))
pdepth -= len(operator_list) - 1
continue

if len(operator_list) != 1:
raise Exception(err_msg)

try:
value = next(token_iter)
Expand Down

0 comments on commit 351960c

Please sign in to comment.