-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Empty cable objects after deleting last termination #10769
Comments
Same here. |
I think our current sticking point is deciding whether or not the above assertion is true. I don't have a strong opinion either way, but the current implementation permits cables to exist with no terminations at either end. Whether this was by design or by accident I can't recall. 😆 |
It is physically possible for a cable to exist without terminations so it should probably be possible too in the documentation for that cable. imho. |
Yes but then you have to reference it somewhere in the Doku. I see 3 possible solutions for this:
I would prefer the third way |
We discussed this in today's maintainers meeting, and the consensus was to delete a cable upon the deletion of its last termination. In the UI, this will first prompt the user to confirm the cable's deletion. |
What will the default behaviour for the API be? Alternatively, can we specify they behaviour in the API call? |
Thinking for the API case it should probably maintain default of not deleting the cable, but provide an option "delete_if_unterminated" or something on the termination delete API. Also there is the bulk-disconnect case, not sure if it makes sense to put a cable deletion confirmation on that as well.. would need to filter the cables that have no terminations and present a list of all of them. |
I'm getting an AtributeError when trying to edit a cable after deleting all terminations on one side:
|
@PaulWestphal :
|
If it is possible to have cable without one termination end, we should also allow cables to be created without one termination end. Consider the following scenario: The device fails and needs to be replaced ( like for like) and all cables new to be moved from failed device to the new device. Since cables can't be re-assigned they need to be deleted and re-created. I can't create a cable without connecting to A and B, yet having a cable with only one termination end is allowed |
This is not true, you can re-assign the ends of cables.
It's not really by design though, so I'm not sure it should be used as an argument. |
This is not completely false. You can re-assign cables to same type of destination. You can't re-assign them to another type. If you want to change the destination from Interface to front-port there is currently no possibility to do it without recreating. |
His scenario was from two devices of the same type - a replacement of a broken device. Regardless, it seems unlikely that supporting changing the termination type will be supported by the fix to this issue. It was also suggested recently in a seperate issue: |
I interpret the following
as: what's currently a bug will no longer be a bug. My point is that if I can get to this state by deleting one side, I should able be able to get to this state by simply creating the cable. |
After talking to Jeremy: |
After digging into this I'm not sure the proposed solution for confirmation to delete the cable if remove all terminations is the correct solution. I've created a separate FR #13972 This solution allows filtering of cables if they have a_terminations and/or b_terminations - so the user can filter if not a an b terminations and find any unterminated cables and just manually remove them if needed. There are several issues with the confirm on delete solution:
IMHO: Probably most companies would have a procedure for either always keeping or deleting the cable and therefore it probably makes more sense as a config setting (AUTO_DELETE_UNTERMINATED_CABLES) that is used to automatically delete or not-delete cables when the last termination is deleted - this can then be used in both the UI and API case. |
What is so bad about just keeping the now half or disconnected cable? They are entities like any other in the data model. They have their own page (Connection/Cables). If one could sort by A or B termination in that page, one would easily find them. They could potentially, in real life, be hanging out of a device on the move. Or be laying around ready for re-use. They could be labeled with some asset barcode and have a length and color. They don't just vanish in thin air if one just happens to disconnect it. |
We've gone back and forth on this a bit, but I agree that leaving the cable in place after all its terminations have been deleted is the most and consistent and therefor least surprising choice, and best accommodates programmatic logic. As @arthanson mentions, now that we've introduced the ability to easily filter for cables with no terminations, this should no longer be needed, so I'm going to close it out. |
NetBox version
v3.3.5
Python version
3.10
Steps to Reproduce
Expected Behavior
The Cable object should be deleted after deleting the last termination.
Observed Behavior
The Cable object is not deleted and has no terminations in it.
The text was updated successfully, but these errors were encountered: