fixed error handling

pull/18777/head
Jason Edelman 8 years ago committed by Matt Clay
parent 5640711166
commit 5d033241af

@ -450,7 +450,8 @@ def apply_value_map(value_map, resource):
def execute_config_command(commands, module): def execute_config_command(commands, module):
try: try:
module.configure(commands) module.configure(commands)
except ShellError, clie: except ShellError:
clie = get_exception()
module.fail_json(msg='Error sending CLI commands', module.fail_json(msg='Error sending CLI commands',
error=str(clie), commands=commands) error=str(clie), commands=commands)
@ -479,7 +480,8 @@ def execute_show(cmds, module, command_type=None):
response = module.execute(cmds, command_type=command_type) response = module.execute(cmds, command_type=command_type)
else: else:
response = module.execute(cmds) response = module.execute(cmds)
except ShellError, clie: except ShellError:
clie = get_exception()
module.fail_json(msg='Error sending {0}'.format(command), module.fail_json(msg='Error sending {0}'.format(command),
error=str(clie)) error=str(clie))
return response return response

Loading…
Cancel
Save