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 Mar 21, 2024
1 parent bca18f9 commit fa318e4
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 21 deletions.
21 changes: 11 additions & 10 deletions plugins/module_utils/network/ios/facts/acls/acls.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@

from ansible.module_utils._text import to_text
from ansible.module_utils.six import iteritems
from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import (
utils,
)
from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import utils
from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.rm_base.network_template import (
NetworkTemplate,
)
Expand Down Expand Up @@ -108,7 +106,8 @@ def populate_facts(self, connection, ansible_facts, data=None):
if namedata:
# parse just names to update empty acls
templateObjName = NetworkTemplate(
lines=namedata.splitlines(), tmplt=AclsTemplate()
lines=namedata.splitlines(),
tmplt=AclsTemplate(),
)
raw_acl_names = templateObjName.parse()
raw_acls = self.populate_empty_acls(raw_acls, raw_acl_names)
Expand Down Expand Up @@ -150,12 +149,13 @@ def process_protocol_options(each):
for each_ace in each.get("aces"):
if each.get("acl_type") == "standard":
if len(each_ace.get("source", {})) == 1 and each_ace.get(
"source", {}
"source",
{},
).get(
"address",
):
each_ace["source"]["host"] = each_ace["source"].pop(
"address"
"address",
)
if each_ace.get("source", {}).get("address"):
addr = each_ace.get("source", {}).get("address")
Expand All @@ -171,7 +171,8 @@ def process_protocol_options(each):
each_ace["protocol_options"] = {
each_ace["protocol"]: {
each_ace.pop("icmp_igmp_tcp_protocol").replace(
"-", "_"
"-",
"_",
): True,
},
}
Expand All @@ -194,11 +195,11 @@ def collect_remarks(aces):
if not rem.get(i.get("is_remark_for")):
rem[i.get("is_remark_for")] = {"remarks": []}
rem[i.get("is_remark_for")]["remarks"].append(
i.get("the_remark")
i.get("the_remark"),
)
else:
rem[i.get("is_remark_for")]["remarks"].append(
i.get("the_remark")
i.get("the_remark"),
)
else:
if rem:
Expand All @@ -217,7 +218,7 @@ def collect_remarks(aces):
{
"sequence": pending_rem_seq,
"remarks": pending_rem_val.get("remarks"),
}
},
)
else:
# this handles the classic set of remarks at the end, which is not tied to
Expand Down
4 changes: 1 addition & 3 deletions plugins/modules/ios_acls.py
Original file line number Diff line number Diff line change
Expand Up @@ -2784,9 +2784,7 @@
from ansible_collections.cisco.ios.plugins.module_utils.network.ios.argspec.acls.acls import (
AclsArgs,
)
from ansible_collections.cisco.ios.plugins.module_utils.network.ios.config.acls.acls import (
Acls,
)
from ansible_collections.cisco.ios.plugins.module_utils.network.ios.config.acls.acls import Acls


def main():
Expand Down
12 changes: 4 additions & 8 deletions tests/unit/modules/network/ios/test_ios_acls.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@ def setUp(self):
"ansible_collections.ansible.netcommon.plugins.module_utils.network.common.rm_base.resource_module_base."
"get_resource_connection",
)
self.get_resource_connection_facts = (
self.mock_get_resource_connection_facts.start()
)
self.get_resource_connection_facts = self.mock_get_resource_connection_facts.start()

self.mock_execute_show_command = patch(
"ansible_collections.cisco.ios.plugins.module_utils.network.ios.facts.acls.acls."
Expand All @@ -40,9 +38,7 @@ def setUp(self):
"ansible_collections.cisco.ios.plugins.module_utils.network.ios.facts.acls.acls."
"AclsFacts.get_acl_names",
)
self.execute_show_command_name = (
self.mock_execute_show_command_name_specific.start()
)
self.execute_show_command_name = self.mock_execute_show_command_name_specific.start()

def tearDown(self):
super(TestIosAclsModule, self).tearDown()
Expand Down Expand Up @@ -1816,7 +1812,7 @@ def test_ios_acls_parsed_multioption(self):
"address": "172.16.1.0",
"wildcard_bits": "0.0.0.255",
},
}
},
],
},
{
Expand Down Expand Up @@ -1861,7 +1857,7 @@ def test_ios_acls_parsed_multioption(self):
],
},
],
}
},
]
self.assertEqual(parsed_list, result["parsed"])

Expand Down

0 comments on commit fa318e4

Please sign in to comment.