Skip to content

Commit

Permalink
Handle Empty LLDP Neighbor Information in facts
Browse files Browse the repository at this point in the history
  • Loading branch information
roverflow committed Aug 27, 2024
1 parent 72225be commit 31cfeba
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions changelogs/fragments/lldp_facts.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
bugfixes:
- facts - Fixes issue where the LLDP neighbor information returns an error when empty.
3 changes: 2 additions & 1 deletion plugins/module_utils/network/nxos/facts/legacy/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,8 @@ def populate(self):
self.populate_ipv6_interfaces(interfaces)

data = self.run("show lldp neighbors", output="json")
if data:
neigh_count = data.get("neigh_count", '0')
if data and int(neigh_count) != 0:
if isinstance(data, dict):
self.facts["neighbors"].update(
self.populate_structured_neighbors_lldp(data),
Expand Down

0 comments on commit 31cfeba

Please sign in to comment.