From 67bd8f9204baacf298e15b1f8e52957933415135 Mon Sep 17 00:00:00 2001 From: Trishna Guha Date: Fri, 5 May 2017 08:35:16 +0530 Subject: [PATCH] fixes nxos_interface (#24199) Signed-off-by: Trishna Guha --- .../modules/network/nxos/nxos_interface.py | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/lib/ansible/modules/network/nxos/nxos_interface.py b/lib/ansible/modules/network/nxos/nxos_interface.py index 071b43b4046..19a48310671 100644 --- a/lib/ansible/modules/network/nxos/nxos_interface.py +++ b/lib/ansible/modules/network/nxos/nxos_interface.py @@ -221,21 +221,22 @@ def get_manual_interface_attributes(interface, module): if get_interface_type(interface) == 'svi': command = 'show interface {0}'.format(interface) try: - body = execute_show_command(command, module)[0] + body = run_commands(module, [command])[0] except IndexError: return None - command_list = body.split('\n') - desc = None - admin_state = 'up' - for each in command_list: - if 'Description:' in each: - line = each.split('Description:') - desc = line[1].strip().split('MTU')[0].strip() - elif 'Administratively down' in each: - admin_state = 'down' - - return dict(description=desc, admin_state=admin_state) + if body: + command_list = body.split('\n') + desc = None + admin_state = 'up' + for each in command_list: + if 'Description:' in each: + line = each.split('Description:') + desc = line[1].strip().split('MTU')[0].strip() + elif 'Administratively down' in each: + admin_state = 'down' + + return dict(description=desc, admin_state=admin_state) else: return None