parent
b20bfc1048
commit
841d204d0d
2 changed files with 24 additions and 0 deletions
|
@ -197,6 +197,9 @@ class Vlans(ConfigBase):
|
|||
def generate_commands(vlan_id, to_set, to_remove):
|
||||
commands = []
|
||||
for key, value in to_set.items():
|
||||
if value is None:
|
||||
continue
|
||||
|
||||
commands.append("{0} {1}".format(key, value))
|
||||
|
||||
for key in to_remove.keys():
|
||||
|
|
21
test/integration/targets/eos_vlans/tests/cli/idempotent.yaml
Normal file
21
test/integration/targets/eos_vlans/tests/cli/idempotent.yaml
Normal file
|
@ -0,0 +1,21 @@
|
|||
---
|
||||
- eos_facts:
|
||||
gather_network_resources: vlans
|
||||
become: yes
|
||||
|
||||
- name: Ensures that facts are idempotent through replace
|
||||
eos_vlans:
|
||||
config: "{{ ansible_facts.network_resources.vlans }}"
|
||||
state: replaced
|
||||
register: result
|
||||
become: yes
|
||||
|
||||
- eos_facts:
|
||||
gather_network_resources: vlans
|
||||
become: yes
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == False"
|
||||
- "result.commands == []"
|
||||
- "ansible_facts.network_resources.vlans|symmetric_difference(result.before) == []"
|
Loading…
Reference in a new issue