Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix inventory.py to work with nautobot 1.3.1 #135

Merged
merged 4 commits into from
Apr 21, 2022

Conversation

gneville-ot
Copy link
Contributor

Since upgrading to nautobot 1.3.1 the inventory plugin errors with:

  File "/home/appuser/.ansible/collections/ansible_collections/networktocode/nautobot/plugins/inventory/inventory.py", line 1349, in main
    self.fetch_api_docs()
  File "/home/appuser/.ansible/collections/ansible_collections/networktocode/nautobot/plugins/inventory/inventory.py", line 1074, in fetch_api_docs
    self.allowed_device_query_parameters = [p["name"] for p in openapi["paths"]["/dcim/devices/"]["get"]["parameters"]]

It seems /api was missing from the paths when getting device and vm query parameters, adding it resolves the issue.

@glennmatthews
Copy link

Interesting, we didn't intentionally change the paths in the OpenAPI schema in Nautobot 1.3, this may have been an unintended consequence of the move to OpenAPI 3.0 in nautobot/nautobot#1544. This change looks safe enough as a workaround but this may be worth considering to be a bug in Nautobot as well.

@FragmentedPacket
Copy link
Contributor

@gneville-ot mind fixing the linting? Once tests pass we can get this merged in.

@jvanderaa jvanderaa changed the base branch from develop to main April 20, 2022 21:55
@jvanderaa jvanderaa changed the base branch from main to develop April 20, 2022 21:57
@FragmentedPacket FragmentedPacket merged commit 6602e1b into nautobot:develop Apr 21, 2022
FragmentedPacket added a commit that referenced this pull request Apr 21, 2022
* Update inventory.py

* Update inventory.py

* Fix linting issue

* Fix virtual machines URL. Updated CI for better Nautobot version test matrix.

Co-authored-by: Mikhail Yohman <mikhail.yohman@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants