1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Fix ios_system lookup enable issue (#30263)

Fixes #29974

Add `None` check while comparing module parameter values (want) with the actual
configuration present on device (have).
This commit is contained in:
Ganesh Nalawade 2017-09-13 15:19:09 +05:30 committed by GitHub
parent 8489e298ca
commit d8371cec91
2 changed files with 25 additions and 1 deletions

View file

@ -146,7 +146,7 @@ def map_obj_to_commands(want, have, module):
commands = list() commands = list()
state = module.params['state'] state = module.params['state']
needs_update = lambda x: want.get(x) and (want.get(x) != have.get(x)) needs_update = lambda x: want.get(x) is not None and (want.get(x) != have.get(x))
if state == 'absent': if state == 'absent':
if have['hostname'] != 'Router': if have['hostname'] != 'Router':

View file

@ -33,6 +33,30 @@
that: that:
- result.changed == false - result.changed == false
- name: Disable lookup_source
ios_system:
lookup_enabled: False
provider: "{{ cli }}"
authorize: yes
register: result
- assert:
that:
- result.changed == true
- "'no ip domain lookup' in result.commands"
- name: Disable lookup_source
ios_system:
lookup_enabled: True
provider: "{{ cli }}"
authorize: yes
register: result
- assert:
that:
- result.changed == true
- "'ip domain lookup' in result.commands"
#- name: change to vrf #- name: change to vrf
# ios_system: # ios_system:
# lookup_source: # lookup_source: