Fixing nxos_vpc (#5031)

pull/18777/head
Gabriele 8 years ago committed by Matt Clay
parent 9ff6070eb8
commit 8f331e01ca

@ -829,6 +829,15 @@ def execute_config_command(commands, module):
clie = get_exception() 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)
except AttributeError:
try:
commands.insert(0, 'configure')
module.cli.add_commands(commands, output='config')
module.cli.run_commands()
except ShellError:
clie = get_exception()
module.fail_json(msg='Error sending CLI commands',
error=str(clie), commands=commands)
def get_cli_body_ssh(command, response, module): def get_cli_body_ssh(command, response, module):
@ -861,6 +870,19 @@ def execute_show(cmds, module, command_type=None):
clie = get_exception() clie = get_exception()
module.fail_json(msg='Error sending {0}'.format(cmds), module.fail_json(msg='Error sending {0}'.format(cmds),
error=str(clie)) error=str(clie))
except AttributeError:
try:
if command_type:
command_type = command_type_map.get(command_type)
module.cli.add_commands(cmds, output=command_type)
response = module.cli.run_commands()
else:
module.cli.add_commands(cmds, raw=True)
response = module.cli.run_commands()
except ShellError:
clie = get_exception()
module.fail_json(msg='Error sending {0}'.format(cmds),
error=str(clie))
return response return response
@ -1133,6 +1155,8 @@ def main():
changed = True changed = True
execute_config_command(cmds, module) execute_config_command(cmds, module)
end_state = get_vpc(module) end_state = get_vpc(module)
if 'configure' in cmds:
cmds.pop(0)
results = {} results = {}
results['proposed'] = proposed results['proposed'] = proposed

Loading…
Cancel
Save