Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Apr 8, 2024
1 parent b7aa918 commit 0b150fd
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 18 deletions.
63 changes: 45 additions & 18 deletions plugins/plugin_utils/pop_ace.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,29 +36,56 @@ def check_match(ace, match_criteria, match_all, name, afi):
for k, v in match_criteria.items():
if v:
if k not in ["source", "destination", "acl_name", "afi"]:
check_arr.append(True) if ace.get(k, "NA") == match_criteria.get(
k,
) else check_arr.append(False)
(
check_arr.append(True)
if ace.get(k, "NA")
== match_criteria.get(
k,
)
else check_arr.append(False)
)
elif k == "acl_name":
check_arr.append(True) if name == match_criteria.get(
k,
) else check_arr.append(False)
(
check_arr.append(True)
if name
== match_criteria.get(
k,
)
else check_arr.append(False)
)
elif k == "afi":
check_arr.append(True) if afi == match_criteria.get(
k,
) else check_arr.append(False)
(
check_arr.append(True)
if afi
== match_criteria.get(
k,
)
else check_arr.append(False)
)
else: # for source and destination address
_sub = "source" if "source" in k else "destination"
_valid = []
_valid.append(True) if ace.get(_sub, {}).get("address", "NA") == match_criteria.get(
k,
) else _valid.append(False)
_valid.append(True) if ace.get(_sub, {}).get("host", "NA") == match_criteria.get(
k,
) else _valid.append(False)
_valid.append(True) if ace.get(_sub, {}).get("any", "NA") == (
match_criteria.get(k) == "any"
) else _valid.append(False)
(
_valid.append(True)
if ace.get(_sub, {}).get("address", "NA")
== match_criteria.get(
k,
)
else _valid.append(False)
)
(
_valid.append(True)
if ace.get(_sub, {}).get("host", "NA")
== match_criteria.get(
k,
)
else _valid.append(False)
)
(
_valid.append(True)
if ace.get(_sub, {}).get("any", "NA") == (match_criteria.get(k) == "any")
else _valid.append(False)
)
check_arr.append(any(_valid))

if match_all: # forces all criteria to match
Expand Down
1 change: 1 addition & 0 deletions plugins/sub_plugins/cli_parser/content_templates_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
The parser functionality used by the network resource modules is leveraged here.
"""

from __future__ import absolute_import, division, print_function


Expand Down

0 comments on commit 0b150fd

Please sign in to comment.