1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

implements command_string property when preparing commands

* commands that need | json added now use command_string property
* adds additonal keyword args in exception handling for json commands
This commit is contained in:
Peter Sprygada 2016-08-25 22:10:00 -04:00
parent e375bfd6a5
commit 5036bba2e0

View file

@ -251,7 +251,7 @@ class Cli(CliBase):
except ValueError:
raise NetworkError(
msg='unable to load response from device',
response=responses[index]
response=responses[index], command=str(cmd)
)
return responses
@ -287,5 +287,5 @@ def prepare_commands(commands):
jsonify = lambda x: '%s | json' % x
for cmd in to_list(commands):
if cmd.output == 'json':
cmd.command = jsonify(cmd)
cmd.command_string = jsonify(cmd)
yield cmd