Don't use netconf's discard_changes when the device has no candidate cap (#19626)

The discard_changes netconf RPC requires the candidate capability.
We were getting an exception when configuring that kind of device.

Fixes #19529
pull/19555/merge
Leandro Lisboa Penz 8 years ago committed by Peter Sprygada
parent c58278b1c2
commit 0296f70f07

@ -136,7 +136,8 @@ def netconf_edit_config(m, xml, commit, retkwargs):
datastore = 'running'
m.lock(target=datastore)
try:
m.discard_changes()
if ":candidate" in m.server_capabilities:
m.discard_changes()
config_before = m.get_config(source=datastore)
m.edit_config(target=datastore, config=xml)
config_after = m.get_config(source=datastore)

Loading…
Cancel
Save