fixes issue when piping commands through json with output not specifed

There is an issue when piping cli commands through json but the output
is specified as either text or the output is none and the transport is
cli.  The results would not be loaded properly for conditional
evaluation.  This is similar to #17422
pull/4420/head
Peter Sprygada 2016-09-06 16:55:53 -04:00
parent 37f721f315
commit c228dfe692
1 changed files with 2 additions and 0 deletions

View File

@ -283,4 +283,6 @@ def prepare_commands(commands):
for cmd in to_list(commands):
if cmd.output == 'json':
cmd.command_string = jsonify(cmd)
if cmd.command.endswith('| json'):
cmd.output = 'json'
yield cmd