Skip to content

Commit

Permalink
Fix issue with replaced (#69477)
Browse files Browse the repository at this point in the history
Signed-off-by: NilashishC <nilashishchakraborty8@gmail.com>

Add changelog
  • Loading branch information
NilashishC committed Jun 17, 2020
1 parent e652706 commit 156b302
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
3 changes: 3 additions & 0 deletions changelogs/fragments/nxos_l2_interfaces_replaced.yaml
Original file line number Diff line number Diff line change
@@ -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)
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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

0 comments on commit 156b302

Please sign in to comment.