|
|
@ -148,7 +148,6 @@ def main():
|
|
|
|
result = {'changed': False, 'warnings': warnings}
|
|
|
|
result = {'changed': False, 'warnings': warnings}
|
|
|
|
|
|
|
|
|
|
|
|
running = None
|
|
|
|
running = None
|
|
|
|
response = None
|
|
|
|
|
|
|
|
commit = not module.check_mode
|
|
|
|
commit = not module.check_mode
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
running = restconf.get(module, path, output=format)
|
|
|
|
running = restconf.get(module, path, output=format)
|
|
|
@ -162,7 +161,7 @@ def main():
|
|
|
|
if method == 'delete':
|
|
|
|
if method == 'delete':
|
|
|
|
if running:
|
|
|
|
if running:
|
|
|
|
if commit:
|
|
|
|
if commit:
|
|
|
|
response = restconf.edit_config(module, path=path, method='DELETE')
|
|
|
|
restconf.edit_config(module, path=path, method='DELETE')
|
|
|
|
result['changed'] = True
|
|
|
|
result['changed'] = True
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
warnings.append("delete not executed as resource '%s' does not exist" % path)
|
|
|
|
warnings.append("delete not executed as resource '%s' does not exist" % path)
|
|
|
@ -182,7 +181,7 @@ def main():
|
|
|
|
result['diff'] = {'prepared': diff, 'before': candidate, 'after': running}
|
|
|
|
result['diff'] = {'prepared': diff, 'before': candidate, 'after': running}
|
|
|
|
|
|
|
|
|
|
|
|
if commit:
|
|
|
|
if commit:
|
|
|
|
response = restconf.edit_config(module, path=path, content=diff, method=method.upper(), format=format)
|
|
|
|
restconf.edit_config(module, path=path, content=diff, method=method.upper(), format=format)
|
|
|
|
result['changed'] = True
|
|
|
|
result['changed'] = True
|
|
|
|
|
|
|
|
|
|
|
|
except ConnectionError as exc:
|
|
|
|
except ConnectionError as exc:
|
|
|
|