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 API swagger docs fetch url error #7401

Closed
cybarox opened this issue Sep 30, 2021 · 10 comments
Closed

NetBox API swagger docs fetch url error #7401

cybarox opened this issue Sep 30, 2021 · 10 comments
Assignees
Labels
status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application

Comments

@cybarox
Copy link
Contributor

cybarox commented Sep 30, 2021

NetBox version

v3.0.4

Python version

3.8

Steps to Reproduce

  1. open https://demo.netbox.dev/api/docs/
  2. View Fetch Error

Expected Behavior

API docs opens

Observed Behavior

API docs show Fetch URL error

@cybarox cybarox added the type: bug A confirmed report of unexpected behavior in the application label Sep 30, 2021
@jeremystretch
Copy link
Member

jeremystretch commented Sep 30, 2021

Looks like a bug in an upstream dependency. This is actively being worked on by the respective teams, so we'll hold off a bit to see how they decide to handle it.

In the meantime, you can work around this bug by directly installing jsonschema 3.2.0 within the NetBox virtual environment and restarting the NetBox service:

cd /opt/netbox/
source venv/bin/activate
pip install jsonschema==3.2.0
sudo systemctl restart netbox netbox-rq

Edit: I've fixed the demo instance.

@jeremystretch jeremystretch added the status: under review Further discussion is needed to determine this issue's scope and/or implementation label Sep 30, 2021
@jeremystretch jeremystretch pinned this issue Sep 30, 2021
@tirkarthi
Copy link

python-jsonschema/jsonschema#845 (comment)

4.0.0 has now been yanked and 4.0.1 was released with a fix for python_requires

@jeremystretch
Copy link
Member

Well that was fast! Thanks for the heads up, @tirkarthi! Appreciate the quick fix!

@cybarox
Copy link
Contributor Author

cybarox commented Sep 30, 2021

with jsonschema==4.0.1 still the same issue, temp fix works for me

@jeremystretch
Copy link
Member

Agreed, still seems to be an issue.

@tirkarthi
Copy link

Is there a traceback showing the error in jsonschema?

@jeremystretch
Copy link
Member

jeremystretch commented Sep 30, 2021

@tirkarthi here's what I've narrowed it down to:

$ python3.7 -m venv testing
$ source testing/bin/activate
(testing) $ pip install swagger_spec_validator
Collecting swagger_spec_validator
  Using cached swagger_spec_validator-2.7.3-py2.py3-none-any.whl (27 kB)
Collecting six
  Using cached six-1.16.0-py2.py3-none-any.whl (11 kB)
Collecting pyyaml
  Using cached PyYAML-5.4.1-cp37-cp37m-manylinux1_x86_64.whl (636 kB)
Collecting jsonschema
  Using cached jsonschema-4.0.1-py3-none-any.whl (69 kB)
Collecting attrs>=17.4.0
  Using cached attrs-21.2.0-py2.py3-none-any.whl (53 kB)
Collecting pyrsistent!=0.17.0,!=0.17.1,!=0.17.2,>=0.14.0
  Using cached pyrsistent-0.18.0-cp37-cp37m-manylinux1_x86_64.whl (119 kB)
Collecting importlib-metadata; python_version < "3.8"
  Using cached importlib_metadata-4.8.1-py3-none-any.whl (17 kB)
Collecting typing-extensions>=3.6.4; python_version < "3.8"
  Using cached typing_extensions-3.10.0.2-py3-none-any.whl (26 kB)
Collecting zipp>=0.5
  Using cached zipp-3.6.0-py3-none-any.whl (5.3 kB)
Installing collected packages: six, pyyaml, attrs, pyrsistent, typing-extensions, zipp, importlib-metadata, jsonschema, swagger-spec-validator
Successfully installed attrs-21.2.0 importlib-metadata-4.8.1 jsonschema-4.0.1 pyrsistent-0.18.0 pyyaml-5.4.1 six-1.16.0 swagger-spec-validator-2.7.3 typing-extensions-3.10.0.2 zipp-3.6.0
WARNING: You are using pip version 20.1.1; however, version 21.2.4 is available.
You should consider upgrading via the '/home/jstretch/testing/bin/python3.7 -m pip install --upgrade pip' command.

$ python
Python 3.7.10 (default, Feb 20 2021, 21:17:23) 
[GCC 7.5.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from swagger_spec_validator import ref_validators
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/jstretch/testing/lib/python3.7/site-packages/swagger_spec_validator/__init__.py", line 8, in <module>
    from swagger_spec_validator.util import validate_spec_url
  File "/home/jstretch/testing/lib/python3.7/site-packages/swagger_spec_validator/util.py", line 9, in <module>
    from swagger_spec_validator import validator12
  File "/home/jstretch/testing/lib/python3.7/site-packages/swagger_spec_validator/validator12.py", line 29, in <module>
    from swagger_spec_validator.ref_validators import default_handlers
  File "/home/jstretch/testing/lib/python3.7/site-packages/swagger_spec_validator/ref_validators.py", line 14, in <module>
    from jsonschema.compat import iteritems
ModuleNotFoundError: No module named 'jsonschema.compat'
>>> 

@tirkarthi
Copy link

Ok, it seems swagger project still needs to pin down the version.

@tirkarthi
Copy link

Yelp/swagger_spec_validator#146 seems to fix this.

@jeremystretch
Copy link
Member

I should have this fixed for us by pinning jsonschema==3.2.0 for now. We should revisit this once swagger_spec_validator has been updated.

@jeremystretch jeremystretch added status: accepted This issue has been accepted for implementation and removed status: under review Further discussion is needed to determine this issue's scope and/or implementation labels Sep 30, 2021
@jeremystretch jeremystretch self-assigned this Sep 30, 2021
@jeremystretch jeremystretch unpinned this issue Oct 4, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 30, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application
Projects
None yet
Development

No branches or pull requests

3 participants