Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[2.9] Fix issue with state replaced #69477

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions changelogs/fragments/nxos_l2_interfaces_replaced.yaml
@@ -0,0 +1,3 @@
---
bugfixes:
- Fix issue with nxos_l2_interfaces where replaced doesn't remove superfluous config (https://github.com/ansible-collections/cisco.nxos/pull/55)
Expand Up @@ -161,7 +161,7 @@ def _state_replaced(self, w, have):
del diff[k]
replaced_commands = self.del_attribs(diff)

if merged_commands:
if merged_commands or replaced_commands:
cmds = set(replaced_commands).intersection(set(merged_commands))
for cmd in cmds:
merged_commands.remove(cmd)
Expand Down
Expand Up @@ -39,6 +39,10 @@
vlan: 8
trunk:
allowed_vlans: "10-12"

- name: '{{ test_int2 }}'
trunk:
allowed_vlans: 25-27
state: replaced
register: result

Expand All @@ -48,7 +52,9 @@
- "'interface {{ test_int1 }}' in result.commands"
- "'switchport access vlan 8' in result.commands"
- "'switchport trunk allowed vlan 10,11,12' in result.commands"
- "result.commands|length == 3"
- "'interface {{ test_int2 }}' in result.commands"
- "'no switchport trunk native vlan' in result.commands"
- result.commands|length == 5

- name: Gather l2_interfaces post facts
nxos_facts: *facts
Expand Down