From ba3485999a3d4f7d98fa6e171d5b7f1365b2752a Mon Sep 17 00:00:00 2001 From: Gabriele Date: Fri, 30 Sep 2016 16:16:47 -0400 Subject: [PATCH] Fixing nxos_vrrp (#5035) --- network/nxos/nxos_vrrp.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/network/nxos/nxos_vrrp.py b/network/nxos/nxos_vrrp.py index 073ee8d2e58..c389a90dec4 100644 --- a/network/nxos/nxos_vrrp.py +++ b/network/nxos/nxos_vrrp.py @@ -277,6 +277,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_vrrp(command, response, module): @@ -323,7 +332,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() @@ -619,6 +628,8 @@ def main(): execute_config_command(cmds, module) changed = True end_state = get_existing_vrrp(interface, group, module, name) + if 'configure' in cmds: + cmds.pop(0) results = {} results['proposed'] = proposed