mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
fixes nxos_interface (#24199)
Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
This commit is contained in:
parent
cec2b960f8
commit
67bd8f9204
1 changed files with 12 additions and 11 deletions
|
@ -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'
|
||||
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)
|
||||
return dict(description=desc, admin_state=admin_state)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
|
Loading…
Reference in a new issue