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

[Bug]: nb_lookup.py secrets in netbox is deprecated with pynetbox >= 7.01 #929

Closed
equinoxefr opened this issue Jan 24, 2023 · 2 comments
Closed
Labels
bug Something isn't working

Comments

@equinoxefr
Copy link

equinoxefr commented Jan 24, 2023

Ansible NetBox Collection version

v3.10.0

Ansible version

ansible [core 2.14.1]
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/xxxx/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.10/site-packages/ansible
  ansible collection location = /home/xxxx/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.10.8 (main, Nov  1 2022, 14:18:21) [GCC 12.2.0] (/usr/bin/python)
  jinja version = 3.1.2
  libyaml = True

NetBox version

v3.3.5

Python version

3.10

Steps to Reproduce

- name: Obtain list of devices from NetBox
  debug:
    msg: >
      "Device {{ item.value.name }} (ID: {{ item.key }})"
  loop: "{{ query('netbox.netbox.nb_lookup', 'virtual-machines',
                  api_endpoint=netbox_url,
                  token=netbox_token) }}"

Expected Behavior

Get the list of virtual machines. There is an issue opened in pynetbox repo

Observed Behavior


TASK [roles/netbox_prometheus_role : Obtain list of devices from NetBox] **********************************************************************************************************************************************************************************************
task path: /home/xxxx/dev/prometheus/roles/netbox_prometheus_role/tasks/main.yml:35
exception during Jinja2 execution: Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/ansible/template/__init__.py", line 831, in _lookup
    ran = instance.run(loop_terms, variables=self._available_variables, **kwargs)
  File "/home/xxxx/.ansible/collections/ansible_collections/netbox/netbox/plugins/lookup/nb_lookup.py", line 409, in run
    netbox = pynetbox.api(
TypeError: Api.__init__() got an unexpected keyword argument 'private_key'
fatal: [xxxx]: FAILED! => {
    "msg": "An unhandled exception occurred while running the lookup plugin 'netbox.netbox.nb_lookup'. Error was a <class 'TypeError'>, original message: Api.__init__() got an unexpected keyword argument 'private_key'. Api.__init__() got an unexpected keyword argument 'private_key'"
}
@sc68cal
Copy link
Contributor

sc68cal commented Jan 24, 2023

I think #928 is working to resolve this

@rodvand rodvand pinned this issue Jan 28, 2023
@rfdrake rfdrake mentioned this issue Feb 5, 2023
@rodvand
Copy link
Contributor

rodvand commented Feb 12, 2023

Should be fixed in collection 3.11.0.

@rodvand rodvand closed this as completed Feb 12, 2023
@rodvand rodvand unpinned this issue Feb 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants