Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Nikitin committed Oct 14, 2024
1 parent 432b8fe commit b663c7e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
2 changes: 2 additions & 0 deletions changelogs/fragments/1335-api-status-page-not-found.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bugfixes:
- fix call /api/status/ instead /api/status in nb_inventory plugin. (https://github.com/netbox-community/ansible_modules/issues/1335).
20 changes: 10 additions & 10 deletions plugins/inventory/nb_inventory.py
Original file line number Diff line number Diff line change
Expand Up @@ -1348,9 +1348,9 @@ def refresh_services(self):
service_id = service["id"]

if service.get("device"):
self.device_services_lookup[service["device"]["id"]][
service_id
] = service
self.device_services_lookup[service["device"]["id"]][service_id] = (
service
)

if service.get("virtual_machine"):
self.vm_services_lookup[service["virtual_machine"]["id"]][
Expand Down Expand Up @@ -1486,14 +1486,14 @@ def refresh_ipaddresses(self):

if ipaddress["assigned_object_type"] == "virtualization.vminterface":
self.vm_ipaddresses_lookup[ip_id] = ipaddress_copy
self.vm_ipaddresses_intf_lookup[interface_id][
ip_id
] = ipaddress_copy
self.vm_ipaddresses_intf_lookup[interface_id][ip_id] = (
ipaddress_copy
)
else:
self.device_ipaddresses_lookup[ip_id] = ipaddress_copy
self.device_ipaddresses_intf_lookup[interface_id][
ip_id
] = ipaddress_copy # Remove "assigned_object_X" attributes, as that's redundant when ipaddress is added to an interface
self.device_ipaddresses_intf_lookup[interface_id][ip_id] = (
ipaddress_copy # Remove "assigned_object_X" attributes, as that's redundant when ipaddress is added to an interface
)

del ipaddress_copy["assigned_object_id"]
del ipaddress_copy["assigned_object_type"]
Expand Down Expand Up @@ -1607,7 +1607,7 @@ def fetch_api_docs(self):
cached_api_version = None
cache = None

status = self._fetch_information(self.api_endpoint + "/api/status")
status = self._fetch_information(self.api_endpoint + "/api/status/")
netbox_api_version = ".".join(status["netbox-version"].split(".")[:2])

if version.parse(netbox_api_version) >= version.parse("3.5.0"):
Expand Down

0 comments on commit b663c7e

Please sign in to comment.