Ignore lines that do not have the key in them
Some switches return multi-line output, which breaks the split function, the change seeks to only preform the split on a line that has the key.
This commit is contained in:
parent
e6bf26967c
commit
2091b040ff
1 changed files with 1 additions and 1 deletions
|
@ -54,7 +54,7 @@ def gather_lldp():
|
||||||
lldp_entries = output.split("\n")
|
lldp_entries = output.split("\n")
|
||||||
|
|
||||||
for entry in lldp_entries:
|
for entry in lldp_entries:
|
||||||
if entry:
|
if entry.startswith('lldp'):
|
||||||
path, value = entry.strip().split("=", 1)
|
path, value = entry.strip().split("=", 1)
|
||||||
path = path.split(".")
|
path = path.split(".")
|
||||||
path_components, final = path[:-1], path[-1]
|
path_components, final = path[:-1], path[-1]
|
||||||
|
|
Loading…
Reference in a new issue