Make lldp check neighbors more robust for config_management
it can not find neighbors in some env and will throw exception when config_management is running. this change will catch all exception and not break config. Closes-bug: 1811040 Change-Id: I11b73a647addddf198723bc2654dac444d82d165 Signed-off-by: Sun Austin <austin.sun@intel.com>
This commit is contained in:
parent
37d4413861
commit
a6c51fe49e
|
@ -67,7 +67,11 @@ def configure_management():
|
|||
print("Retrieving neighbor details... ", end=' ')
|
||||
lldpcli_show_output = subprocess.check_output(
|
||||
['sudo', 'lldpcli', 'show', 'neighbors', 'summary', '-f', 'json'])
|
||||
lldp_interfaces = json.loads(lldpcli_show_output)['lldp'][0]['interface']
|
||||
try:
|
||||
lldp_interfaces = json.loads(
|
||||
lldpcli_show_output)['lldp'][0]['interface']
|
||||
except Exception as e:
|
||||
lldp_interfaces = {}
|
||||
print("DONE")
|
||||
|
||||
print("\nAvailable interfaces:")
|
||||
|
|
Loading…
Reference in New Issue