From 534dbb094b1474c21c0957879231404dc27d992d Mon Sep 17 00:00:00 2001 From: Kevin Kuhls Date: Wed, 8 Feb 2017 08:58:23 -0500 Subject: [PATCH] adding support for no candidate config (#20821) commit fails for devices with no candidate config, such as when configuraion is written to running-config store. Commit is set to True in main's call of netconf_edit_config. The simple edit is to add the additional logic around sending the commit. Otherwise you could change commit could be set to (if ":candidate" in m.server_capabilities) in the call of netconf_edit_config. Either way would work. I'll defer for the decision of which. --- lib/ansible/modules/network/netconf/netconf_config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ansible/modules/network/netconf/netconf_config.py b/lib/ansible/modules/network/netconf/netconf_config.py index 5955063085..e7ab3bdbb4 100755 --- a/lib/ansible/modules/network/netconf/netconf_config.py +++ b/lib/ansible/modules/network/netconf/netconf_config.py @@ -142,7 +142,7 @@ def netconf_edit_config(m, xml, commit, retkwargs): m.edit_config(target=datastore, config=xml) config_after = m.get_config(source=datastore) changed = config_before.data_xml != config_after.data_xml - if changed and commit: + if changed and commit and ":candidate" in m.server_capabilities: if ":confirmed-commit" in m.server_capabilities: m.commit(confirmed=True) m.commit()