-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Connected Endpoint is not updated when Cable is updated #2994
Comments
Looked into this a little bit, looks like there are a couple of things going on here.. First, when a cable is created, it saves the "connected interface" into the interfaces table for that specific interface. When a cable is updated, that interface is suppose to be updated by a signal, however it cannot because, at least in my testing, I found there was a duplicate foreign key from the old value. We cod do away with this caching, and instead run direct calls to get_path_endpoints(), however that presents another problem, which is we would most likely need to run several database queries for each cable to get endpoints. This could have a negative performance impact. Another way, is to possibly add in a pre_save and have that remove the endpoint from the model first, but I think @jeremystretch and @lampwins should weigh in first if we even want to do this. I am not 100% familiar with DJango signals. |
I think the most reasonable approach is to disallow modifying the endpoint of an existing cable. This was never part of the intended workflow; the cable should be deleted and a new one created with the desired endpoints. |
FYI: I can fix this as part of #3633. |
@steffann How are you proposing to fix it? If you do fix it, it would be best to have it part of a separate commit. |
Agreed. Bugs need to be addressed individually and not conflated with separate feature work. This allows us to clearly track how they are fixed (or not fixed) over time. |
This bug is a side effect of limitations in the current way connected endpoints are implemented. My suggestion is to improve the endpoint handling to be more flexible, and then this bug won't be an issue anymore. There have been multiple bugs that are caused by architectural limitations. Let's fix the architecture instead of paying whack-a-mole with the resulting bugs. |
Environment
Steps to Reproduce
sw_port1 id: 10925
srv_port1 id: 10929
srv_port2 id: 10930
cable id: 688
curl -X PUT "http://netbox/api/dcim/cables/688/" -H "accept: application/json" -H "Content-Type: application/json" -H "X-CSRFToken: ...." -d "{ \"termination_a_type\": \"dcim.interface\", \"termination_a_id\": 10930, \"termination_b_type\": \"dcim.interface\", \"termination_b_id\": 10925}"
Expected Behavior
Observed Behavior
PS
But in the cable information is all correct:
The text was updated successfully, but these errors were encountered: