|
|
@ -198,6 +198,7 @@ class InventoryModule(BaseInventoryPlugin, Constructable):
|
|
|
|
"device_roles": self.extract_device_role,
|
|
|
|
"device_roles": self.extract_device_role,
|
|
|
|
"platforms": self.extract_platform,
|
|
|
|
"platforms": self.extract_platform,
|
|
|
|
"device_types": self.extract_device_type,
|
|
|
|
"device_types": self.extract_device_type,
|
|
|
|
|
|
|
|
"config_context": self.extract_config_context,
|
|
|
|
"manufacturers": self.extract_manufacturer
|
|
|
|
"manufacturers": self.extract_manufacturer
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -246,6 +247,14 @@ class InventoryModule(BaseInventoryPlugin, Constructable):
|
|
|
|
except Exception:
|
|
|
|
except Exception:
|
|
|
|
return
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def extract_config_context(self, host):
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
|
|
|
url = urljoin(self.api_endpoint, "/api/dcim/devices/" + str(host["id"]))
|
|
|
|
|
|
|
|
device_lookup = self._fetch_information(url)
|
|
|
|
|
|
|
|
return [device_lookup["config_context"]]
|
|
|
|
|
|
|
|
except Exception:
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
|
|
def extract_manufacturer(self, host):
|
|
|
|
def extract_manufacturer(self, host):
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
return [self.manufacturers_lookup[host["device_type"]["manufacturer"]["id"]]]
|
|
|
|
return [self.manufacturers_lookup[host["device_type"]["manufacturer"]["id"]]]
|
|
|
|