summaryrefslogtreecommitdiff
path: root/network/nxos
diff options
context:
space:
mode:
authorGabriele <gabrielegerbino@gmail.com>2016-09-30 16:20:37 -0400
committerPeter Sprygada <privateip@users.noreply.github.com>2016-09-30 16:20:37 -0400
commit33b8a897022fbc966a8e82d0a31a144cfb017806 (patch)
treefa16716aee8cbd4a16ac57ef58f80b93957f230f /network/nxos
parent11f628a1242634eaa5061bfac81f0cecc938bf43 (diff)
downloadansible-modules-core-33b8a897022fbc966a8e82d0a31a144cfb017806.tar.gz
Fixing nxos_smu (#5021)
Diffstat (limited to 'network/nxos')
-rw-r--r--network/nxos/nxos_smu.py20
1 files changed, 16 insertions, 4 deletions
diff --git a/network/nxos/nxos_smu.py b/network/nxos/nxos_smu.py
index 310fe7fc..f89aeb37 100644
--- a/network/nxos/nxos_smu.py
+++ b/network/nxos/nxos_smu.py
@@ -256,7 +256,7 @@ def execute_show(cmds, module, command_type=None):
module.cli.add_commands(cmds, output=command_type)
response = module.cli.run_commands()
else:
- module.cli.add_commands(cmds, output=command_type)
+ module.cli.add_commands(cmds, raw=True)
response = module.cli.run_commands()
except ShellError:
clie = get_exception()
@@ -286,12 +286,21 @@ def remote_file_exists(module, dst, file_system='bootflash:'):
def execute_config_command(commands, module):
try:
- response = module.configure(commands)
+ output = module.configure(commands)
except ShellError:
clie = get_exception()
module.fail_json(msg='Error sending CLI commands',
error=str(clie), commands=commands)
- return response
+ except AttributeError:
+ try:
+ commands.insert(0, 'configure')
+ module.cli.add_commands(commands, output='config')
+ output = module.cli.run_commands()
+ except ShellError:
+ clie = get_exception()
+ module.fail_json(msg='Error sending CLI commands',
+ error=str(clie), commands=commands)
+ return output
def apply_patch(module, commands):
@@ -353,11 +362,14 @@ def main():
if not module.check_mode and commands:
try:
apply_patch(module, commands)
- changed=True
+ changed = True
except ShellError:
e = get_exception()
module.fail_json(msg=str(e))
+ if 'configure' in commands:
+ commands.pop(0)
+
module.exit_json(changed=changed,
pkg=pkg,
file_system=file_system,