Cables not editable if one end of the cable is connected to device that was deleted #8352

Closed
opened 2025-12-29 20:35:42 +01:00 by adam · 4 comments
Owner

Originally created by @pv2b on GitHub (Jul 21, 2023).

NetBox version

v3.5.6

Python version

3.10

Steps to Reproduce

  1. Create two devices called TEST1 and TEST2. Type is not impotant, but make sure they have one interface each.
  2. Connect a cable between TEST1 and TEST2, doesn't matter which interfaces, as long as it's a cable between the two devices.
  3. Delete device TEST2.
  4. Find the cable that was connecting TEST1 and TEST2 (e.g. through the interface list on TEST1) and click on it.
  5. Verify that there is a termination on Termination A to device TEST1, but Termination B is shown as "No termination."
  6. Click on "Edit".

Expected Behavior

The edit screen for the cable should appear, allowing me to edit the cable, including changing the termination to something new.

Observed Behavior

The following error message is shown on screen:

Server Error

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

The complete exception is provided below:

<class 'AttributeError'>

'str' object has no attribute 'label'

Python version: 3.10.6
NetBox version: 3.5.6

If further assistance is required, please post to the NetBox discussion forum on GitHub.

NOTE: As far as I can tell, it's not possible to have a cable that is unterminated on one end under normal circumstances, at least not through the GUI. This might explain why perhaps the edit page isn't set up to expect one end of the cable to be unterminated.

Originally created by @pv2b on GitHub (Jul 21, 2023). ### NetBox version v3.5.6 ### Python version 3.10 ### Steps to Reproduce 1. Create two devices called TEST1 and TEST2. Type is not impotant, but make sure they have one interface each. 2. Connect a cable between TEST1 and TEST2, doesn't matter which interfaces, as long as it's a cable between the two devices. 3. Delete device TEST2. 4. Find the cable that was connecting TEST1 and TEST2 (e.g. through the interface list on TEST1) and click on it. 5. Verify that there is a termination on Termination A to device TEST1, but Termination B is shown as "No termination." 6. Click on "Edit". ### Expected Behavior The edit screen for the cable should appear, allowing me to edit the cable, including changing the termination to something new. ### Observed Behavior The following error message is shown on screen: > Server Error > > There was a problem with your request. Please contact an administrator. > > The complete exception is provided below: > > <class 'AttributeError'> > > 'str' object has no attribute 'label' > > Python version: 3.10.6 > NetBox version: 3.5.6 > > If further assistance is required, please post to the [NetBox discussion forum](https://github.com/netbox-community/netbox/discussions) on GitHub. NOTE: As far as I can tell, it's not possible to have a cable that is unterminated on one end under normal circumstances, at least not through the GUI. This might explain why perhaps the edit page isn't set up to expect one end of the cable to be unterminated.
adam added the status: duplicate label 2025-12-29 20:35:42 +01:00
adam closed this issue 2025-12-29 20:35:42 +01:00
Author
Owner

@pv2b commented on GitHub (Jul 21, 2023):

I gave fixing this a try, since I thought it might be a quick and easy fix of a type error somewhere. However, unfortunately it would seem that there's a fundamental lack of functionality in the cable edit form as is right now, that's beyond my ability to fix.

The issue is that there's no way to select the termination type in the cable form. In other words, once you have decided that a cable connects from an Interface to and Interface, there's no way to in the GUI edit the cable so it's instead going from an Interface to a Front Port, for example. Because there's no currently written functionality for setting a termination type, the GUI just lets you change the termination itself, not the termination type. There'd need to be a picker in the edit form to change the termination type for the use case of editing a cable that's missing one termination to make sense.

As far as I see it there's two possible paths to take here:

  1. Extend the cable edit form with functionality to change termination type after the fact.
  2. Extend the logic for deleting a device so that all cables terminated in that device get deleted on deleting the device, alternatively, do not allow a device with cables present to be deleted. That way, since you can never have a dangling cable to start with, you can never hit this bug.

Either way, unfortunately, this involves adding some kind of new functionality, not simply squashing a bug.

Personally, I prefer option 1, since I like the idea of having a cable that's not terminated in both ends. This can be useful for these purposes:

  • Keeping inventory of unused cables that are not yet connected anywhere. (In this case it has neither an A termination nor a B termination!)
  • Document cables you know where one end goes, but not the other one (at least not yet)
  • Document cables that are not plugged in in both ends by design (for example a cable left in a datacenter to allow a laptop to be plugged in by a visiting technician)
@pv2b commented on GitHub (Jul 21, 2023): I gave fixing this a try, since I thought it might be a quick and easy fix of a type error somewhere. However, unfortunately it would seem that there's a fundamental lack of functionality in the cable edit form as is right now, that's beyond my ability to fix. The issue is that there's no way to select the termination type in the cable form. In other words, once you have decided that a cable connects from an Interface to and Interface, there's no way to in the GUI edit the cable so it's instead going from an Interface to a Front Port, for example. Because there's no currently written functionality for setting a termination type, the GUI just lets you change the termination itself, not the termination type. There'd need to be a picker in the edit form to change the termination type for the use case of editing a cable that's missing one termination to make sense. As far as I see it there's two possible paths to take here: 1. Extend the cable edit form with functionality to change termination type after the fact. 2. Extend the logic for deleting a device so that all cables terminated in that device get deleted on deleting the device, alternatively, do not allow a device with cables present to be deleted. That way, since you can never have a dangling cable to start with, you can never hit this bug. Either way, unfortunately, this involves adding some kind of new functionality, not simply squashing a bug. Personally, I prefer option 1, since I like the idea of having a cable that's not terminated in both ends. This can be useful for these purposes: - Keeping inventory of unused cables that are not yet connected anywhere. (In this case it has neither an A termination nor a B termination!) - Document cables you know where one end goes, but not the other one (at least not yet) - Document cables that are not plugged in in both ends by design (for example a cable left in a datacenter to allow a laptop to be plugged in by a visiting technician)
Author
Owner

@pv2b commented on GitHub (Jul 21, 2023):

Just one final comment, there's nothing in the underlying data model that makes it impossible to change the termination model of a cable after the fact, so if you ever run into this, a possible workaround is to use the "bulk import" mode to update the termination of the cable, bypassing this GUI bug, for example using this CSV "bulk import":

id,side_b_type,side_b_device,side_b_name
111,dcim.interface,Test1,2
@pv2b commented on GitHub (Jul 21, 2023): Just one final comment, there's nothing in the underlying data model that makes it impossible to change the termination model of a cable after the fact, so if you ever run into this, a possible workaround is to use the "bulk import" mode to update the termination of the cable, bypassing this GUI bug, for example using this CSV "bulk import": ``` id,side_b_type,side_b_device,side_b_name 111,dcim.interface,Test1,2 ```
Author
Owner

@cpmills1975 commented on GitHub (Jul 21, 2023):

I'm not currently running the most recent version of NetBox, but I'm sure that in the version I am running, deleting a device would delete any cables attached to it. You can't actually edit the terminations of a cable anyway (or you can't in the version I'm running - perhaps that has changed).

Perhaps the functionality to delete a cable has been removed now cables can be connected to multiple devices?

Perhaps a cable should automatically be deleted when all the devices on one end of it no longer exist?

@cpmills1975 commented on GitHub (Jul 21, 2023): I'm not currently running the most recent version of NetBox, but I'm sure that in the version I am running, deleting a device would delete any cables attached to it. You can't actually edit the terminations of a cable anyway (or you can't in the version I'm running - perhaps that has changed). Perhaps the functionality to delete a cable has been removed now cables can be connected to multiple devices? Perhaps a cable should automatically be deleted when all the devices on one end of it no longer exist?
Author
Owner

@kkthxbye-code commented on GitHub (Jul 23, 2023):

Duplicate of https://github.com/netbox-community/netbox/issues/11460

@kkthxbye-code commented on GitHub (Jul 23, 2023): Duplicate of https://github.com/netbox-community/netbox/issues/11460
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#8352