Validation needed when expanding the U height of a device type #363

Closed
opened 2025-12-29 16:21:18 +01:00 by adam · 6 comments
Owner

Originally created by @LordBoBCUP on GitHub (Aug 15, 2016).

I am getting a weird error when trying to view one of the racks I had previously setup. I have recently upgraded to v1.5.2 and when viewing a specific rack for a specific site I am getting an error, traceback below.
Traceback:

File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/exception.py" in inner

  1.         response = get_response(request)
    

File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" in _legacy_get_response

  1.         response = self._get_response(request)
    

File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" in _get_response

  1.             response = self.process_exception_by_middleware(e, request)
    

File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" in _get_response

  1.             response = wrapped_callback(request, _callback_args, *_callback_kwargs)
    

File "/opt/netbox-1.5.1/netbox/dcim/views.py" in rack

  1.     'front_elevation': rack.get_front_elevation(),
    

File "/opt/netbox-1.5.1/netbox/dcim/models.py" in get_front_elevation

  1.     return self.get_rack_units(face=RACK_FACE_FRONT, remove_redundant=True)
    

File "/opt/netbox-1.5.1/netbox/dcim/models.py" in get_rack_units

  1.                 elevation[device.position]['device'] = device
    

Exception Type: KeyError at /dcim/racks/11/
Exception Value: 20

Originally created by @LordBoBCUP on GitHub (Aug 15, 2016). I am getting a weird error when trying to view one of the racks I had previously setup. I have recently upgraded to v1.5.2 and when viewing a specific rack for a specific site I am getting an error, traceback below. Traceback: File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/exception.py" in inner 1. response = get_response(request) File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" in _legacy_get_response 1. response = self._get_response(request) File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" in _get_response 1. response = self.process_exception_by_middleware(e, request) File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" in _get_response 1. response = wrapped_callback(request, _callback_args, *_callback_kwargs) File "/opt/netbox-1.5.1/netbox/dcim/views.py" in rack 1. 'front_elevation': rack.get_front_elevation(), File "/opt/netbox-1.5.1/netbox/dcim/models.py" in get_front_elevation 1. return self.get_rack_units(face=RACK_FACE_FRONT, remove_redundant=True) File "/opt/netbox-1.5.1/netbox/dcim/models.py" in get_rack_units 1. elevation[device.position]['device'] = device Exception Type: KeyError at /dcim/racks/11/ Exception Value: 20
adam added the type: bug label 2025-12-29 16:21:18 +01:00
adam closed this issue 2025-12-29 16:21:18 +01:00
Author
Owner

@jeremystretch commented on GitHub (Aug 15, 2016):

v1.5.2 hasn't been released yet. Are you running the development branch?

@jeremystretch commented on GitHub (Aug 15, 2016): v1.5.2 hasn't been released yet. Are you running the development branch?
Author
Owner

@LordBoBCUP commented on GitHub (Aug 16, 2016):

Sorry Jeremy, running v1.5.1 from the master branch. Must have fat fingered it.

@LordBoBCUP commented on GitHub (Aug 16, 2016): Sorry Jeremy, running v1.5.1 from the master branch. Must have fat fingered it.
Author
Owner

@jeremystretch commented on GitHub (Aug 16, 2016):

I'm not able to replicate this. Can you provide a list of devices installed in the rack, including their positions/faces and device type heights?

@jeremystretch commented on GitHub (Aug 16, 2016): I'm not able to replicate this. Can you provide a list of devices installed in the rack, including their positions/faces and device type heights?
Author
Owner

@LordBoBCUP commented on GitHub (Aug 17, 2016):

I think I have narrowed it down. I had made a change to a device type, and not viewed that particular rack since making the change. The device I had changed is only in that 1 rack as well which is why I didn't see the error anywhere else. Sadly I have changed a few other things in that rack (positions within the rack) but I think it was because once I had changed it from 1RU to 2RU there was another 1RU device in the second RU spot for the first device if that makes sense.

I have just retested expanding the 1RU device type to 2RU and viewing the rack is fine. However, if you expand a 1RU device type into a 2RU device and on a rack where the next RU is already consumed, you appear to get that error. Perhaps we need some validation when changing the RU of a device type to see all the racks where its used, if the next RU slot is free or not? I know changing the device type post using it isn't recommended, but in this instance, the specs says its 1RU but really, its fatter than 1RU and the second RU slot is not really usable so I wanted to effectively mark it 2RU or at least the second RU occupied to avoid people trying to use it in the future.

@LordBoBCUP commented on GitHub (Aug 17, 2016): I think I have narrowed it down. I had made a change to a device type, and not viewed that particular rack since making the change. The device I had changed is only in that 1 rack as well which is why I didn't see the error anywhere else. Sadly I have changed a few other things in that rack (positions within the rack) but I think it was because once I had changed it from 1RU to 2RU there was another 1RU device in the second RU spot for the first device if that makes sense. I have just retested expanding the 1RU device type to 2RU and viewing the rack is fine. However, if you expand a 1RU device type into a 2RU device and on a rack where the next RU is already consumed, you appear to get that error. Perhaps we need some validation when changing the RU of a device type to see all the racks where its used, if the next RU slot is free or not? I know changing the device type post using it isn't recommended, but in this instance, the specs says its 1RU but really, its fatter than 1RU and the second RU slot is not really usable so I wanted to effectively mark it 2RU or at least the second RU occupied to avoid people trying to use it in the future.
Author
Owner

@puck commented on GitHub (Sep 12, 2016):

I've hit this as well - took a while for me track down the device which caused the issue!

@puck commented on GitHub (Sep 12, 2016): I've hit this as well - took a while for me track down the device which caused the issue!
Author
Owner

@puck commented on GitHub (Sep 12, 2016):

Actually, doing the validation when the device type might be time consuming depending on how many racks the device type is present in. Perhaps the display of the rack should catch that error and show an error for the U space involved?

@puck commented on GitHub (Sep 12, 2016): Actually, doing the validation when the device type might be time consuming depending on how many racks the device type is present in. Perhaps the display of the rack should catch that error and show an error for the U space involved?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#363