Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

[Bug]: nb_inventory failed '/api/dcim/devices/' #1320

Closed
wols opened this issue Sep 13, 2024 · 0 comments
Closed

[Bug]: nb_inventory failed '/api/dcim/devices/' #1320

wols opened this issue Sep 13, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@wols
Copy link

wols commented Sep 13, 2024

Ansible NetBox Collection version

v3.20.0

Ansible version

ansible [core 2.14.16]
  config file = /home/USER/path/to/ansible.cfg
  configured module search path = ['/home/USER/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3/dist-packages/ansible
  ansible collection location = /home/USER/path/to
  executable location = /usr/bin/ansible
  python version = 3.11.2 (main, Aug 26 2024, 07:20:54) [GCC 12.2.0] (/usr/bin/python3)
  jinja version = 3.1.2
  libyaml = True

NetBox version

v4.1.0

Python version

3.11

Steps to Reproduce

# path/to/inventory/01_netbox.yml
---
plugin: netbox.netbox.nb_inventory

api_endpoint: http://A.B.C.D/netbox
token: 1234567890123456789012345678901234567890
validate_certs: false
config_context: false

Expected Behavior

Debian Bookworm 12.7 up to date:

The inventory works witch netbox v4.0.11 and ansible_modules v3.19.1 (despite the message Collection netbox.netbox does not support Ansible version 2.14.16).

After update to netbox v4.1.0 the error as below and ansible_module v3.20.0 brought no change.

Observed Behavior

$ ansible-inventory -i inventory/01_netbox.yml --list -vvv
ansible-inventory [core 2.14.16]
  config file = /home/USER/path/to/ansible.cfg
  configured module search path = ['/home/USER/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3/dist-packages/ansible
  ansible collection location = /home/USER/path/to
  executable location = /usr/bin/ansible-inventory
  python version = 3.11.2 (main, Aug 26 2024, 07:20:54) [GCC 12.2.0] (/usr/bin/python3)
  jinja version = 3.1.2
  libyaml = True
Using /home/USER/path/to/ansible.cfg as config file
host_list declined parsing /home/USER/path/to/inventory/01_netbox.yml as it did not pass its verify_file() method
script declined parsing /home/USER/path/to/inventory/01_netbox.yml as it did not pass its verify_file() method
[WARNING]: Collection netbox.netbox does not support Ansible version 2.14.16
Using inventory plugin 'ansible_collections.netbox.netbox.plugins.inventory.nb_inventory' to process inventory source '/home/USER/path/to/inventory/01_netbox.yml'
Fetching: http://A.B.C.D/netbox/api/status
toml declined parsing /home/USER/path/to/inventory/01_netbox.yml as it did not pass its verify_file() method
[WARNING]:  * Failed to parse /home/USER/path/to/inventory/01_netbox.yml with auto plugin: '/api/dcim/devices/'
  File "/usr/lib/python3/dist-packages/ansible/inventory/manager.py", line 293, in parse_source
    plugin.parse(self._inventory, self._loader, source, cache=cache)
  File "/usr/lib/python3/dist-packages/ansible/plugins/inventory/auto.py", line 59, in parse
    plugin.parse(inventory, loader, path, cache=cache)
  File "/home/USER/path/to/ansible_collections/netbox/netbox/plugins/inventory/nb_inventory.py", line 2179, in parse
    self.main()
  File "/home/USER/path/to/ansible_collections/netbox/netbox/plugins/inventory/nb_inventory.py", line 2018, in main
    self.fetch_api_docs()
  File "/home/USER/path/to/ansible_collections/netbox/netbox/plugins/inventory/nb_inventory.py", line 1627, in fetch_api_docs
    for p in openapi["paths"]["/api/dcim/devices/"]["get"]["parameters"]
             ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
[WARNING]:  * Failed to parse [...] AnsibleParserError('Plugin configuration YAML file, not YAML inventory')
[WARNING]:  * Failed to parse [...] AnsibleParserError(e)
[WARNING]: Unable to parse /home/wUSER/path/to/inventory/01_netbox.yml as an inventory source
[WARNING]: No inventory was parsed, only implicit localhost is available
{
    "_meta": {
        "hostvars": {}
    },
    "all": {
        "children": [
            "ungrouped"
        ]
    }
}
@wols wols added the bug Something isn't working label Sep 13, 2024
@wols wols changed the title [Bug]: [Bug]: nb_inventory failed '/api/dcim/devices/' Sep 13, 2024
@netbox-community netbox-community locked and limited conversation to collaborators Sep 22, 2024
@rodvand rodvand converted this issue into discussion #1324 Sep 22, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant