From aa1e3ef2b50797edb778ab6149ead376ec21b1d3 Mon Sep 17 00:00:00 2001
From: Peter Sprygada <privateip@users.noreply.github.com>
Date: Fri, 23 Sep 2016 12:09:55 -0400
Subject: [PATCH] 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.
---
 lib/ansible/module_utils/nxos.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/ansible/module_utils/nxos.py b/lib/ansible/module_utils/nxos.py
index f4cd90e0c3..298c8e0cdc 100644
--- a/lib/ansible/module_utils/nxos.py
+++ b/lib/ansible/module_utils/nxos.py
@@ -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: