fixes issue introduced with raw kwarg (#17728)

The raw kwarg was added to return raw output from devices with if the
attempt to convert to json failed.  The change was causing all json
output to be returned raw.  This fixes that issue.
This commit is contained in:
Peter Sprygada 2016-09-23 12:09:55 -04:00 committed by GitHub
commit aa1e3ef2b5

View file

@ -269,7 +269,8 @@ class Cli(NxapiConfigMixin, CliBase):
cmds = list(prepare_commands(commands))
responses = self.execute(cmds)
for index, cmd in enumerate(commands):
if cmd.output == 'json' and cmd.args.get('raw') is False:
raw = cmd.args.get('raw') or False
if cmd.output == 'json' and not raw:
try:
responses[index] = json.loads(responses[index])
except ValueError: