1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Fxing nxos_ip_interface (#5013)

This commit is contained in:
Gabriele 2016-09-30 16:22:24 -04:00 committed by Matt Clay
parent 6708874f1c
commit 1be7ca4f70

View file

@ -784,6 +784,15 @@ def execute_config_command(commands, module):
clie = get_exception()
module.fail_json(msg='Error sending CLI 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):
@ -817,6 +826,19 @@ def execute_show(cmds, module, command_type=None):
clie = get_exception()
module.fail_json(msg='Error sending {0}'.format(cmds),
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
@ -1186,6 +1208,8 @@ def main():
changed = True
end_state, address_list = get_ip_interface(interface, version,
module)
if 'configure' in cmds:
cmds.pop(0)
results = {}
results['proposed'] = proposed