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 Nov 21, 2024
1 parent 1d36773 commit a336886
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
11 changes: 7 additions & 4 deletions plugins/module_utils/network/ios/config/ospfv2/ospfv2.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,14 @@ def generate_commands(self):
if self.want:
for entry in self.want.get("processes", []):
entry = self._handle_deprecated(entry)
# remove set_interface from passive_intf if it already exists
# remove set_interface from passive_intf if it already exists
passive_intf = entry.get("passive_interfaces", {}).get("interface", {})
if passive_intf and any(h["process_id"] == entry["process_id"] and
h.get("passive_interfaces", {}).get("interface", {}).get("name") == passive_intf.get("name")
for h in self.have.get("processes", [])):
if passive_intf and any(
h["process_id"] == entry["process_id"]
and h.get("passive_interfaces", {}).get("interface", {}).get("name")
== passive_intf.get("name")
for h in self.have.get("processes", [])
):
passive_intf.pop("set_interface", None)
wantd.update({(entry["process_id"], entry.get("vrf")): entry})

Expand Down
7 changes: 3 additions & 4 deletions tests/unit/modules/network/ios/test_ios_ospfv2.py
Original file line number Diff line number Diff line change
Expand Up @@ -1216,13 +1216,13 @@ def test_ios_ospfv2_set_interface_idempotent(self):
network 10.140.2.0 0.0.0.255 area 0
network 10.140.5.0 0.0.0.255 area 0
""",
)
)
set_module_args(
dict(
config=dict(
processes=[
dict(
process_id="1",
process_id="1",
router_id="1.1.1.1",
network=[
dict(
Expand All @@ -1242,7 +1242,7 @@ def test_ios_ospfv2_set_interface_idempotent(self):
name=["GigabitEthernet1"],
),
),
vrf=None,
vrf=None,
),
],
),
Expand All @@ -1251,4 +1251,3 @@ def test_ios_ospfv2_set_interface_idempotent(self):
)

self.execute_module(changed=False, commands=[])

0 comments on commit a336886

Please sign in to comment.