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

Netbox 4.0 failures #134

Open
kollross opened this issue May 8, 2024 · 6 comments
Open

Netbox 4.0 failures #134

kollross opened this issue May 8, 2024 · 6 comments

Comments

@kollross
Copy link

kollross commented May 8, 2024

Since upgrading to Netbox 4.0, I'm running into an error when running nb-dt-import.py. I've performed a git pull but with no updates. I also performed a "[root@netbox-dev] # pip install -r requirements.txt", which updates some packages but nothing resolving the issue.

Netbox 4.0
Python 3.10.12
pynetbox 7.3.3

.env file

NETBOX_URL=https://netbox.mydomain.com
NETBOX_TOKEN=11111112222222223333333444444444
REPO_URL=https://github.com/netbox-community/devicetype-library.git
REPO_BRANCH=master
IGNORE_SSL_ERRORS=False
#SLUGS=c9300-48u isr4431 isr4331

Here is the error:

Package devicetype-library is already installed, updating /opt/Device-Type-Library-Import/repo
Traceback (most recent call last):
  File "/opt/Device-Type-Library-Import/./nb-dt-import.py", line 54, in <module>
    main()
  File "/opt/Device-Type-Library-Import/./nb-dt-import.py", line 17, in main
    netbox = NetBox(settings)
  File "/opt/Device-Type-Library-Import/netbox_api.py", line 28, in __init__
    self.verify_compatibility()
  File "/opt/Device-Type-Library-Import/netbox_api.py", line 50, in verify_compatibility
    version_split = [int(x) for x in self.netbox.version.split('.')]
  File "/opt/Device-Type-Library-Import/venv/lib/python3.10/site-packages/pynetbox/core/api.py", line 109, in version
    ).get_version()
  File "/opt/Device-Type-Library-Import/venv/lib/python3.10/site-packages/pynetbox/core/query.py", line 187, in get_version
    raise RequestError(req)
pynetbox.core.query.RequestError: The request failed with code 403 Forbidden: {'detail': 'Authentication credentials were not provided.'}

On the Netbox side I'm seeing this error in the logs

2024-05-08 09:12:29,896 django.request WARNING: Forbidden: /api/
2024-05-08 09:12:38,751 django.request WARNING: Forbidden: /api/
2024-05-08 09:12:54,906 django.request WARNING: Forbidden: /api/
2024-05-08 09:13:47,340 django.request WARNING: Forbidden: /api/
2024-05-08 09:19:24,318 django.request WARNING: Forbidden: /api/
@mjrduarte
Copy link

I can confirm this error.

Netbox 4.0.2
Python 3.12.3
pynetbox 7.0.1

@StillLoading
Copy link

The "issue" seems to be related to this change netbox-community/netbox/pull/16122

Setting the option back to "False" allows the script to connect again.

@licebmi
Copy link

licebmi commented Jun 3, 2024

Issue seems to be caused by this line:

version_split = [int(x) for x in self.netbox.version.split('.')]

The pynetbox library doesn't pass a token when getting netbox version
https://github.com/netbox-community/pynetbox/blob/1b397f04ad104970e3f7d76efe990e56da8a7727/pynetbox/core/api.py#L111

netbox-community/pynetbox#612

@TalkBackJohnny
Copy link

Having the same error. Is there a fix? Thanks

@sevsev9
Copy link

sevsev9 commented Jun 20, 2024

Having the same error. Is there a fix? Thanks

This fix has been working for me so far: #141 (comment)

@imuab
Copy link

imuab commented Jul 8, 2024

Authenticaion failure for Netbox 4.x is fixed in pynetbox 7.3.4: netbox-community/pynetbox#616
I can confirm that the fix is working. The requirements.txt should be updated.

NicJames2378 pushed a commit to NicJames2378/Device-Type-Library-Import that referenced this issue Jul 11, 2024
NicJames2378 added a commit to NicJames2378/Device-Type-Library-Import that referenced this issue Jul 11, 2024
rondemena added a commit to rondemena/Device-Type-Library-Import that referenced this issue Sep 6, 2024
in reference to the netbox-community#134 requirements.txt update need
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

No branches or pull requests

7 participants