fixes issue in nxos_config when retrieving current config (#21843)

When parsing the configuration, the wrong indent level was set so the
configurations could not be properly compared.  Also noted that
defaults: yes needed to be added to the integration tests to make the
test cases valid, which is also included in this patch

fixes #21828
pull/21874/head
Peter Sprygada 8 years ago committed by GitHub
parent 06d0278290
commit 381f7209f8

@ -235,7 +235,7 @@ def get_running_config(module):
if module.params['defaults']: if module.params['defaults']:
flags.append('all') flags.append('all')
contents = get_config(module, flags=flags) contents = get_config(module, flags=flags)
return NetworkConfig(indent=1, contents=contents) return NetworkConfig(indent=2, contents=contents)
def get_candidate(module): def get_candidate(module):
candidate = NetworkConfig(indent=2) candidate = NetworkConfig(indent=2)

@ -14,6 +14,7 @@
- name: configure device with config - name: configure device with config
nxos_config: nxos_config:
src: basic/config.j2 src: basic/config.j2
defaults: yes
provider: "{{ cli }}" provider: "{{ cli }}"
register: result register: result
@ -26,6 +27,7 @@
- name: check device with config - name: check device with config
nxos_config: nxos_config:
src: basic/config.j2 src: basic/config.j2
defaults: yes
provider: "{{ cli }}" provider: "{{ cli }}"
register: result register: result

@ -16,6 +16,7 @@
src: basic/config.j2 src: basic/config.j2
provider: "{{ cli }}" provider: "{{ cli }}"
match: none match: none
defaults: yes
register: result register: result
- assert: - assert:
@ -28,6 +29,7 @@
nxos_config: nxos_config:
src: basic/config.j2 src: basic/config.j2
provider: "{{ cli }}" provider: "{{ cli }}"
defaults: yes
register: result register: result
- assert: - assert:

Loading…
Cancel
Save