Skip to content

Commit 43ab818

Browse files
Fixes site group lookup by using the correct key (#872)
Netbox returns the group association via a `group` key rather than a `site_group` key. This code erroneously looks for `site_group` which will always fail.
1 parent 563ef7f commit 43ab818

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

plugins/inventory/nb_inventory.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -995,9 +995,9 @@ def get_region_for_site(site):
995995
self.sites_region_lookup = dict(map(get_region_for_site, sites))
996996

997997
def get_site_group_for_site(site):
998-
# Will fail if site does not have a site_group defined in NetBox
998+
# Will fail if site does not have a group defined in NetBox
999999
try:
1000-
return (site["id"], site["site_group"]["id"])
1000+
return (site["id"], site["group"]["id"])
10011001
except Exception:
10021002
return (site["id"], None)
10031003

0 commit comments

Comments
 (0)