We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 02f68ce commit 5404678Copy full SHA for 5404678
plugins/inventory/nb_inventory.py
@@ -586,7 +586,18 @@ def extract_primary_ip6(self, host):
586
return
587
588
def extract_tags(self, host):
589
- return host["tags"]
+ try:
590
+ tag_zero = host["tags"][0]
591
+ # Check the type of the first element in the "tags" array.
592
+ # If a dictionary (Netbox >= 2.9), return an array of tags' slugs.
593
+ if isinstance(tag_zero, dict):
594
+ return list(sub["slug"] for sub in host["tags"])
595
+ # If a string (Netbox <= 2.8), return the original "tags" array.
596
+ elif isinstance(tag_zero, str):
597
+ return host["tags"]
598
+ # If tag_zero fails definition (no tags), return the empty array.
599
+ except Exception:
600
601
602
def extract_interfaces(self, host):
603
try:
0 commit comments