NetBox upgrade to 3.0 - Dropdown related issues

197 views
Skip to first unread message

Bhanu Reddy

unread,
Dec 9, 2021, 6:37:06 AM12/9/21
to NetBox
Hi Team,

Currently, I am in netbox 2.11.12 and everything is great.

but when I upgrade to anything in 3.0 all dropdown menus are empty.

I am able to observe, the log as below.. needs some urgent help.

attaching full log also..

Traceback (most recent call last):
  File "/opt/netbox-3.0.1/venv/lib/python3.9/site-packages/django/template/base.py", line 837, in _resolve_lookup
    current = getattr(current, bit)
AttributeError: 'str' object has no attribute 'disabled'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/netbox-3.0.1/venv/lib/python3.9/site-packages/django/template/base.py", line 843, in _resolve_lookup
    current = current[int(bit)]
ValueError: invalid literal for int() with base 10: 'disabled'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/netbox-3.0.1/venv/lib/python3.9/site-packages/django/template/base.py", line 848, in _resolve_lookup
    raise VariableDoesNotExist("Failed lookup for key "
django.template.base.VariableDoesNotExist: Failed lookup for key [disabled] in 'UAT'
Exception while resolving variable 'label' in template 'django/forms/widgets/select.html'.
Traceback (most recent call last):
  File "/opt/netbox-3.0.1/venv/lib/python3.9/site-packages/django/template/base.py", line 829, in _resolve_lookup
    current = current[bit]
TypeError: string indices must be integers

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/netbox-3.0.1/venv/lib/python3.9/site-packages/django/template/base.py", line 837, in _resolve_lookup
    current = getattr(current, bit)
AttributeError: 'str' object has no attribute 'label'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/netbox-3.0.1/venv/lib/python3.9/site-packages/django/template/base.py", line 843, in _resolve_lookup
    current = current[int(bit)]
ValueError: invalid literal for int() with base 10: 'label'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/netbox-3.0.1/venv/lib/python3.9/site-packages/django/template/base.py", line 848, in _resolve_lookup
    raise VariableDoesNotExist("Failed lookup for key "
django.template.base.VariableDoesNotExist: Failed lookup for key [label] in 'UAT'
Exception while resolving variable 'form' in template 'dcim/device_list.html'.
Traceback (most recent call last):
  File "/opt/netbox-3.0.1/venv/lib/python3.9/site-packages/django/template/base.py", line 829, in _resolve_lookup
    current = current[bit]
  File "/opt/netbox-3.0.1/venv/lib/python3.9/site-packages/django/template/context.py", line 83, in __getitem__
    raise KeyError(key)
KeyError: 'form'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/netbox-3.0.1/venv/lib/python3.9/site-packages/django/template/base.py", line 835, in _resolve_lookup
    if isinstance(current, BaseContext) and getattr(type(current), bit):
AttributeError: type object 'RequestContext' has no attribute 'form'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/netbox-3.0.1/venv/lib/python3.9/site-packages/django/template/base.py", line 843, in _resolve_lookup
    current = current[int(bit)]
ValueError: invalid literal for int() with base 10: 'form'

During handling of the above exception, another exception occurred:

netbox.log

Brian Candler

unread,
Dec 9, 2021, 11:49:21 AM12/9/21
to NetBox
I haven't seen this particular error before.

First guess: do you have any plugins enabled?  Some have not been updated to work with Netbox 3.0.  Disable them and try again.

Second guess: did the database migrations complete correctly? "./upgrade.sh" does this for you - but if it reports an error, you need to investigate.  You can't simply run a netbox 3.0.x instance pointing to a netbox 2.11.x database.

I also suggest you should go straight to 3.0.12 not 3.0.1: you'll pick up more bug fixes.  Or you could go to the brand-new 3.1.0 if you like.

Chris Russell

unread,
Dec 9, 2021, 2:40:57 PM12/9/21
to Brian Candler, NetBox
 
 I've had to tweak my (self written) plugins, due to forms extending BootstrapMixin AND CustomFields when used together in forms now not working properly. this may hit a lot of plugins with the upgrade to 3.1

Chris

--
You received this message because you are subscribed to the Google Groups "NetBox" group.
To unsubscribe from this group and stop receiving emails from it, send an email to netbox-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/netbox-discuss/d4d875a1-1af6-4c2a-9047-67b492c88ae7n%40googlegroups.com.

Bhanu Reddy

unread,
Dec 9, 2021, 9:17:20 PM12/9/21
to Brian Candler, NetBox
Hi Brain,

Thank you very much for your quick response.
As suggested will jump to 3.0.12, to answer your question.. we are not using any plugins.
While running upgrade.sh we do not see any errors.

Will update you with our findings.


Bhanu Reddy

unread,
Dec 20, 2021, 4:11:31 AM12/20/21
to Brian Candler, NetBox
Hi Brian,

We have checked everything and found that a security parameter on web server is causing this behaviour.

Header edit Set-Cookie ^(.*)$ $1;HttpOnly;Secure;SameSite=None

This is intended to protect from cross site scripting, this setting doesn’t breathe application till 2.11 however with this setting applied the dropdown menu’s are not working on 3.X
We have checked this on a new installation as well.

Regards
Bhanu

Brian Candler

unread,
Dec 20, 2021, 5:03:26 AM12/20/21
to NetBox
OK, so you can fix it by removing that setting.

Can you show what Set-Cookie header Django *actually* sends? (e.g. with tcpdump on localhost)  If you think it's not correct for security reasons, then you can raise it as an issue on github.  I expect that there's a Django setting which can be tweaked.

Bhanu Reddy

unread,
Dec 20, 2021, 5:27:51 AM12/20/21
to Brian Candler, NetBox
Thanks Brian.

Yes, we are able to get everything work by removing that setting.

That setting basically encrypts the cookies, and allows access to them only via HTTPS.
Will try to get a tcp dump.

The other doubt we have is, the backend application server is on http and apache reverse proxy is accessing it via http, may be it that is also pushed to work on https then it may work with the setting in place.

However, we will share our findings / data with you.

Regards
Bhanu

Brian Candler

unread,
Dec 20, 2021, 7:37:14 AM12/20/21
to NetBox
Setting "Secure" on a cookie doesn't encrypt it.  It just restricts it to being sent over an HTTPS (encrypted) connection - in other words, tells the browser to block sending it over plain HTTP.


> the backend application server is on http and apache reverse proxy is accessing it via http, may be it that is also pushed to work on https then it may work with the setting in place.

The backend makes use of the X-Forwarded-Proto header from the proxy, to know that the real upstream connection is HTTPS.  For example, in rack elevation images, you'll see it generates absolute links with https://... instead of http://...
Reply all
Reply to author
Forward
0 new messages