From c228dfe692b8de524ff16fd71d14af58b00303f7 Mon Sep 17 00:00:00 2001 From: Peter Sprygada Date: Tue, 6 Sep 2016 16:55:53 -0400 Subject: [PATCH] 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 --- lib/ansible/module_utils/nxos.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/ansible/module_utils/nxos.py b/lib/ansible/module_utils/nxos.py index 31fc098c367..689a03a3c0f 100644 --- a/lib/ansible/module_utils/nxos.py +++ b/lib/ansible/module_utils/nxos.py @@ -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