From 07f3b27351e20434a68198a095bd93bdfbf4e589 Mon Sep 17 00:00:00 2001 From: d3justi Date: Sat, 17 Sep 2016 14:32:03 -0500 Subject: [PATCH] added a couple more checks --- lib/ansible/module_utils/nxos.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/lib/ansible/module_utils/nxos.py b/lib/ansible/module_utils/nxos.py index 058c0b946ff..b364468bf46 100644 --- a/lib/ansible/module_utils/nxos.py +++ b/lib/ansible/module_utils/nxos.py @@ -201,14 +201,20 @@ class Nxapi(NxapiConfigMixin): for cmd in commands: if output and output != cmd.output: - responses.extend(self.execute(cmds, output=output)) + try: + responses.extend(self.execute(cmds, output=output)) + except ValueError: + responses.extend(self.execute(cmds)) cmds = list() output = cmd.output cmds.append(str(cmd)) if cmds: - responses.extend(self.execute(cmds, output=output)) + try: + responses.extend(self.execute(cmds, output=output)) + except ValueError: + responses.extend(self.execute(cmds)) return responses @@ -217,7 +223,10 @@ class Nxapi(NxapiConfigMixin): def configure(self, commands): commands = to_list(commands) - return self.execute(commands, output='config') + try: + return self.execute(commands, output='config') + except ValueError: + return self.execute(commands) def _jsonify(self, data): for encoding in ("utf-8", "latin-1"):