Changing localhost address for API

83 views
Skip to first unread message

mucho loco

unread,
Feb 13, 2020, 7:23:40 PM2/13/20
to NetBox
Hi,

I recently built Netbox and although it works fine through the GUI in terms of seeing or adding things you can't get to the API from a browser as says:

 Server Error

There was a problem with your request. Please contact an administrator.


The complete exception is provided below:

<class 'AttributeError'>
'OrderedDict' object has no attribute 'register'

If further assistance is required, please post to the NetBox mailing list.

Using pynetbox you can still edit objects, if I pull down device objects can see that the URL is wrong, in other builds this is the hostname.

{'id': 355,
 'device': {'id': 25,
  'name': 'NATLAB-ASA1',
  'display_name': 'NATLAB-ASA1'},

All I think this is because when I built it I had a second interface on it that was in the 10.x.x.x range. I can always rebuild as is just a lab, just wondered if was any other easy way to fix this?

Thanks

Brian Candler

unread,
Feb 14, 2020, 2:20:21 AM2/14/20
to NetBox
Someone else got that:

For them there was a problem with the wrong version of a library (django-restframework).  Do "pip3 list" and check all the packages match with the versions in requirements.txt

As for the broken URL containing just "10." as the hostname: that's weird.  I thought django would reflect the hostname which is in the Host: header.  Check your apache/nginx config, and also try tcpdump between the webserver and gunicorn to see what Host: header is presented.

mucho loco

unread,
Feb 14, 2020, 1:15:22 PM2/14/20
to NetBox
Hey Brian,

Thanks for the help, never thought it would be 2 seperate issues. It had django-restframework 3.10.3 installed (same as in requirements.txt) so downloaded it to 3.9.4 like in the other post and that fixed the API problem. As for the 10. URL it was a typo in the nginx config file just like you suggested.

Thanks once again for all the help.

Brian Candler

unread,
Feb 14, 2020, 2:31:14 PM2/14/20
to NetBox
There is some underlying problem here.

If you still have the complete output of "pip3 list" from *before* you reverted django-restframework, that would be very helpful to show.

Netbox *should* work with the newer version of django-restframework.  What's likely happening is a dependency-of-a-dependency thing, where downgrading django-restframework has actually downgraded something else that it depends on.  But without seeing the package list of a broken system, the developers can't reproduce this.

mucho loco

unread,
Feb 14, 2020, 6:00:36 PM2/14/20
to NetBox
I didnt have a copy of that so built a new VM and could replicate the same problem. I am using Ubuntu 18.04.4 LTS and Netbox v2.7.6. Install is pretty much same as recommended but using Python venv. Have attached the pip list from the box with the issues, hope it helps. Will leave it in that state so let me know if you need anything else.
pip_list.txt

Brian Candler

unread,
Feb 15, 2020, 5:16:03 AM2/15/20
to NetBox
Thank you very much.  There's a lot that's different between my install and yours (see below). Although Netbox pins the versions of its direct dependencies, the current policy is not to pin the ancestor dependencies.  Unfortunately that results in hard-to-debug problems.

If you could open a bug ticket, giving the *exact* steps to reproduce (including the venv setup), that would be very helpful.

Regards,

Brian.

--- pip_list_candlerb.txt 2020-02-15 10:09:11.233606928 +0000
+++ pip_list_mucholoco.txt 2020-02-15 10:10:58.291518315 +0000
@@ -1,26 +1,24 @@
 Package                  Version
------------------------- ----------------------
-asn1crypto               0.24.0
-bcrypt                   3.1.4
-blinker                  1.3
-certifi                  2018.10.15
-cffi                     1.11.5
-chainmap                 1.0.2
+------------------------ ----------
+attrs                    19.3.0
+backcall                 0.1.0
+bcrypt                   3.1.7
+certifi                  2019.11.28
+cffi                     1.14.0
 chardet                  3.0.4
-click                    6.7
-cloud-init               19.2
-command-not-found        0.3
-configobj                5.0.6
+ciscoconfparse           1.4.11
+Click                    7.0
+colorama                 0.4.3
 coreapi                  2.3.3
 coreschema               0.0.4
-cryptography             2.3.1
+cryptography             2.8
+decorator                4.4.1
 Django                   2.2.10
 django-cacheops          4.2
 django-cors-headers      3.2.1
 django-debug-toolbar     2.1
-django-extensions        2.1.4
 django-filter            2.2.0
-django-js-asset          1.1.0
+django-js-asset          1.2.2
 django-mptt              0.9.1
 django-prometheus        1.1.0
 django-rq                2.2.0
@@ -31,95 +29,68 @@
 djangorestframework      3.10.3
 dnspython                1.16.0
 drf-yasg                 1.17.0
-flex                     6.13.2
-funcy                    1.12
-future                   0.17.1
-graphviz                 0.10.1
-gunicorn                 19.9.0
-idna                     2.7
+funcy                    1.14
+future                   0.18.2
+gunicorn                 20.0.4
+idna                     2.8
+importlib-metadata       1.5.0
 inflection               0.3.1
+ipython                  7.12.0
+ipython-genutils         0.2.0
 itypes                   1.1.0
+jedi                     0.16.0
 Jinja2                   2.10.3
-jsonpatch                1.10
-jsonpointer              1.14
-jsonschema               2.6.0
-jtextfsm                 0.3.1
-junos-eznc               2.1.6
-language-selector        0.1
-librouteros              1.0.3
-lxml                     4.2.5
+jsonschema               3.2.0
+junos-eznc               2.2.1
+lxml                     4.5.0
 Markdown                 2.6.11
-MarkupSafe               1.1.0
-napalm                   2.3.3
-napalm-base              0.25.0
-napalm-eos               0.6.1
-napalm-fortios           0.4.0
-napalm-ios               0.7.0
-napalm-iosxr             0.5.4
-napalm-junos             0.12.0
-napalm-nxos              0.6.0
-napalm-panos             0.4.0
-napalm-pluribus          0.5.1
-napalm-ros               0.2.2
-napalm-vyos              0.1.3
-natsort                  5.3.3
-ncclient                 0.6.0
+MarkupSafe               1.1.1
+napalm                   2.5.0
+napalm-asa               0.1.1
+ncclient                 0.6.7
 netaddr                  0.7.19
-netmiko                  2.3.0
-oauthlib                 1.0.3
-olefile                  0.44
-openapi-codec            1.3.2
-packaging                20.0
-pan-python               0.12.0
-paramiko                 2.4.2
+netmiko                  2.4.2
+nxapi-plumbing           0.5.2
+packaging                20.1
+paramiko                 2.7.1
+parso                    0.6.1
+passlib                  1.7.2
+pexpect                  4.8.0
+pickleshare              0.7.5
 Pillow                   7.0.0
-pip                      19.0.2
-prettytable              0.7.2
+pip                      20.0.2
+pkg-resources            0.0.0
 prometheus-client        0.7.1
+prompt-toolkit           3.0.3
 psycopg2-binary          2.8.4
+ptyprocess               0.6.0
 py-gfm                   0.1.4
-pyasn1                   0.4.4
 pycparser                2.19
 pycryptodome             3.9.4
-pycurl                   7.43.0
-pyeapi                   0.8.1
-pyfg                     0.50
-pygobject                3.20.0
+pyeapi                   0.8.3
+Pygments                 2.5.2
 pyIOSXR                  0.53
-PyJWT                    1.3.0
 PyNaCl                   1.3.0
-pynetbox                 4.0.8
-pynxos                   0.0.3
+pynetbox                 4.2.5
 pyparsing                2.4.6
-pyPluribus               0.3.1
-pyserial                 3.0.1
-python-apt               1.1.0b1+ubuntu0.16.4.8
-python-debian            0.1.27
-python-systemd           231
-pytz                     2018.7
-PyYAML                   3.13
+pyrsistent               0.15.7
+pyserial                 3.4
+pytz                     2019.3
+PyYAML                   5.3
 redis                    3.3.11
-requests                 2.20.0
-requests-toolbelt        0.8.0
-rfc3987                  1.3.8
-rq                       1.0
-ruamel.yaml              0.15.76
-scp                      0.10.2
-setuptools               40.5.0
-simplejson               3.13.2
-six                      1.11.0
-sqlparse                 0.2.4
-ssh-import-id            5.5
-strict-rfc3339           0.7
+requests                 2.22.0
+rq                       1.2.2
+ruamel.yaml              0.16.10
+ruamel.yaml.clib         0.2.0
+scp                      0.13.2
+setuptools               45.2.0
+six                      1.14.0
+sqlparse                 0.3.0
 svgwrite                 1.3.1
-swagger-spec-validator   2.4.1
-textfsm                  0.4.1
-ufw                      0.35
-unattended-upgrades      0.1
-uritemplate              3.0.0
-urllib3                  1.24.1
-validate-email           1.3
-VyattaConfParser         0.5.1
-wheel                    0.29.0
-whitenoise               4.1.1
-xmltodict                0.11.0
+swagger-spec-validator   2.4.3
+textfsm                  1.1.0
+traitlets                4.3.3
+uritemplate              3.0.1
+urllib3                  1.25.8
+wcwidth                  0.1.8
+zipp                     2.2.0

mucho loco

unread,
Feb 23, 2020, 6:35:46 PM2/23/20
to NetBox
Sorry took me a while to get round to doing this, https://github.com/netbox-community/netbox/issues/4248 opened for it

thanks
Reply all
Reply to author
Forward
0 new messages