From 6bedeb28d82cfb640f94ad8860da864b0604967c Mon Sep 17 00:00:00 2001 From: Gabriele Date: Fri, 30 Sep 2016 16:18:40 -0400 Subject: [PATCH] Fixing nxos_switchport (#5028) --- lib/ansible/modules/network/nxos/nxos_switchport.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/ansible/modules/network/nxos/nxos_switchport.py b/lib/ansible/modules/network/nxos/nxos_switchport.py index 6ad12a679df..9803479a178 100644 --- a/lib/ansible/modules/network/nxos/nxos_switchport.py +++ b/lib/ansible/modules/network/nxos/nxos_switchport.py @@ -607,10 +607,7 @@ def get_cli_body_ssh(command, response, module): body = response else: try: - if isinstance(response[0], str): - body = [json.loads(response[0])] - else: - body = response + body = [json.loads(response[0])] except ValueError: module.fail_json(msg='Command does not support JSON output', command=command) @@ -639,7 +636,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) + module.cli.add_commands(cmds, raw=True) response = module.cli.run_commands() except ShellError: clie = get_exception() @@ -792,6 +789,8 @@ def main(): changed = True execute_config_command(cmds, module) end_state = get_switchport(interface, module) + if 'configure' in cmds: + cmds.pop(0) results = {} results['proposed'] = proposed