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

import py fails with a 403 Authentication credentials were not provided. ignores NETBOX_TOKEN #144

Closed
julianfirminger-united opened this issue Jul 9, 2024 · 6 comments

Comments

@julianfirminger-united
Copy link

nb-dt-import.py fails with a 403. It seems to us it's ignoring the .env file?
I have a previous version running on rocky9.3 that works fine, we cant see a conf difference between them.
new nb4 on rokey9.4 does this:

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/lib64/python3.9/site-packages/pynetbox/core/api.py", line 106, in version
    version = Request(
  File "/opt/Device-Type-Library-Import/venv/lib64/python3.9/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.'}

Netbox runs fine, there is an api user with a token enabled. the .env file looks like:

NETBOX_URL=http://<netbox_url>
NETBOX_TOKEN=<token>
REPO_URL=https://github.com/netbox-community/devicetype-library.git
REPO_BRANCH=master
IGNORE_SSL_ERRORS=True
#SLUGS=c9300-48u isr4431 isr4331
@ale456-1
Copy link

Hi @julianfirminger-united.

I had the same error. In my case, i changed the version of pynetbox, from 7.0.1 to 7.3.4 and it started to work, using this command inside my virtual-env:

pip install --force-reinstall -v "pynetbox==7.3.4"

The difference is located in:
[7.0.1]pynetbox/core/query.py:184 vs [7.3.4]pynetbox/core/query.py:196

Hope it can help.

@julianfirminger-united
Copy link
Author

julianfirminger-united commented Jul 12, 2024

@ale456-1 turns out it needed more than that. the installer cant handle the new version number post v4 as it has 3 parts. 4.0.1 etc.
See thisfor the fix:
[((https://github.com//issues/142))]

@kniteli
Copy link

kniteli commented Aug 3, 2024

@julianfirminger-united if you have valid ssl certs there's no issue, you can just run the install mentioned above. I highly recommend spending the 5 bucks a year to grab any old domain and taking the 10 minutes to generate a letsencrypt cert. My registrar has those off brand ones for $1 per year actually

@PadawanDeluxe
Copy link

Hi there,
I can confirm workaround to reinstall pynetbox query per command

pip install --force-reinstall -v "pynetbox==7.3.4"

Quoting out the verification of Netbox version did not help me at this point. I switched backed and reinstalled pynetbox package so I am good to go right now.

regards
Carsten

@Tauebenuss
Copy link

Hi all,

Same Fail in the Docker Container.

Cheers,
Kevin

@julianfirminger-united
Copy link
Author

@ale456-1 turns out it needed more than that. the installer cant handle the new version number post v4 as it has 3 parts. 4.0.1 etc.
See thisfor the fix:
[((https://github.com/https://github.com//issues/142))]

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

5 participants