Fix issue with replaced (#69477)

Signed-off-by: NilashishC <nilashishchakraborty8@gmail.com>

Add changelog
pull/69409/head
Nilashish Chakraborty 5 years ago committed by GitHub
parent e652706d63
commit 156b302b4b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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)

@ -161,7 +161,7 @@ class L2_interfaces(ConfigBase):
del diff[k] del diff[k]
replaced_commands = self.del_attribs(diff) replaced_commands = self.del_attribs(diff)
if merged_commands: if merged_commands or replaced_commands:
cmds = set(replaced_commands).intersection(set(merged_commands)) cmds = set(replaced_commands).intersection(set(merged_commands))
for cmd in cmds: for cmd in cmds:
merged_commands.remove(cmd) merged_commands.remove(cmd)

@ -39,6 +39,10 @@
vlan: 8 vlan: 8
trunk: trunk:
allowed_vlans: "10-12" allowed_vlans: "10-12"
- name: '{{ test_int2 }}'
trunk:
allowed_vlans: 25-27
state: replaced state: replaced
register: result register: result
@ -48,7 +52,9 @@
- "'interface {{ test_int1 }}' in result.commands" - "'interface {{ test_int1 }}' in result.commands"
- "'switchport access vlan 8' in result.commands" - "'switchport access vlan 8' in result.commands"
- "'switchport trunk allowed vlan 10,11,12' 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 - name: Gather l2_interfaces post facts
nxos_facts: *facts nxos_facts: *facts

Loading…
Cancel
Save