Skip to content

Commit

Permalink
Raise exception instead of setting invalid netbox api version
Browse files Browse the repository at this point in the history
This method would previously set netbox_api_version to 0, which is not a valid version that can be parsed. 

This does not fix the issue, but raises this exception with a better message to help the user diagnose

See #1032
  • Loading branch information
sc68cal authored Sep 30, 2023
1 parent 0215e17 commit 6334fcb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion plugins/inventory/nb_inventory.py
Original file line number Diff line number Diff line change
Expand Up @@ -1494,7 +1494,7 @@ def fetch_api_docs(self):
status = self._fetch_information(self.api_endpoint + "/api/status")
netbox_api_version = ".".join(status["netbox-version"].split(".")[:2])
except Exception:
netbox_api_version = 0
raise Exception("Failed to retrieve /api/status or parse netbox_api_version")

tmp_dir = os.path.split(DEFAULT_LOCAL_TMP)[0]
tmp_file = os.path.join(tmp_dir, "netbox_api_dump.json")
Expand Down

0 comments on commit 6334fcb

Please sign in to comment.