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 0e4a6b8 commit 5d6389dCopy full SHA for 5d6389d
plugins/inventory/nb_inventory.py
@@ -1775,8 +1775,12 @@ def extract_name(self, host):
1775
# Use virtual chassis name if set by the user.
1776
if self.virtual_chassis_name and self._get_host_virtual_chassis_master(host):
1777
return host["virtual_chassis"]["name"] or str(uuid.uuid4())
1778
- elif self.hostname_field:
+ elif self.hostname_field and self.hostname_field in host["custom_fields"]:
1779
return host["custom_fields"][self.hostname_field]
1780
+ elif self.hostname_field and (
1781
+ self.hostname_field in host or "." in self.hostname_field
1782
+ ):
1783
+ return self._compose(self.hostname_field, host) or str(uuid.uuid4())
1784
else:
1785
return host["name"] or str(uuid.uuid4())
1786
0 commit comments