Skip to content

Commit

Permalink
Fixes Netconf_config single parameter bug (ansible#56138)
Browse files Browse the repository at this point in the history
* Fixes Netconf_config single parameter bug
Fixes 56022

fixed get_config to not require multiple parameters to just run a backup

* Add Integration test for netconf_config
Associated with ansible#56022

tests backup through netconf only using one parameter.

* Added debug to the begin and end of file

* Fix formatting of save config.  ansible#56022

* removed blank line at end: ansible#56022
  • Loading branch information
wjohnston888 authored and ganeshrn committed May 6, 2019
1 parent 9db3c8a commit 647ed20
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/ansible/module_utils/network/netconf/netconf.py
Expand Up @@ -76,7 +76,7 @@ def locked_config(module, target=None):
unlock_configuration(module, target=target)


def get_config(module, source, filter, lock=False):
def get_config(module, source, filter=None, lock=False):
conn = get_connection(module)
try:
locked = False
Expand Down
2 changes: 1 addition & 1 deletion lib/ansible/modules/network/netconf/netconf_config.py
Expand Up @@ -381,7 +381,7 @@ def main():
if not module.check_mode:
conn.commit()
result['changed'] = True
else:
elif config:
if module.check_mode and not supports_commit:
module.warn("check mode not supported as Netconf server doesn't support candidate capability")
result['changed'] = True
Expand Down
13 changes: 13 additions & 0 deletions test/integration/targets/netconf_config/tests/iosxr/basic.yaml
@@ -0,0 +1,13 @@
---
- debug: msg="START netconf_config iosxr/basic.yaml on connection={{ ansible_connection }}"

- name: save config test
netconf_config:
backup: yes
register: result

- assert:
that:
- "'backup_path' in result"

- debug: msg="END netconf_config iosxr/basic.yaml on connection={{ ansible_connection }}"
Expand Up @@ -52,4 +52,13 @@
lines:
- delete system syslog file test_netconf_config

- name: save config
netconf_config:
backup: yes
register: result

- assert:
that:
- "'backup_path' in result"

- debug: msg="END netconf_config junos/basic.yaml on connection={{ ansible_connection }}"

0 comments on commit 647ed20

Please sign in to comment.