Fix ios and vyos cliconf edit_config return type (#41896)

* Fix ios and vyos cliconf edit_config return type

Modify cliconf edit_config api to return a json string with
diff and response received from remote host for ios and vyos.

* Doc change
This commit is contained in:
Ganesh Nalawade
2018-06-25 15:35:39 +05:30
committed by GitHub
parent d4b9105c9c
commit b84adfd885
5 changed files with 21 additions and 8 deletions

View File

@@ -166,7 +166,8 @@ def load_config(module, commands):
connection = get_connection(module)
try:
diff, response = connection.edit_config(commands)
return response
resp = connection.edit_config(commands)
resp = json.loads(resp)
return resp.get('response')
except ConnectionError as exc:
module.fail_json(msg=to_text(exc))

View File

@@ -133,7 +133,9 @@ def load_config(module, commands, commit=False, comment=None):
connection = get_connection(module)
try:
diff_config, resp = connection.edit_config(candidate=commands, commit=commit, diff=module._diff, comment=comment)
resp = connection.edit_config(candidate=commands, commit=commit, diff=module._diff, comment=comment)
resp = json.loads(resp)
diff_config = resp.get('diff')
except ConnectionError as exc:
module.fail_json(msg=to_text(exc))