mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-15 12:08:17 -06:00
When deleting a cable make sure the trace sees the cable as gone
This commit is contained in:
parent
84c9ef8144
commit
72f4ded24e
@ -64,10 +64,10 @@ def nullify_connected_endpoints(instance, **kwargs):
|
|||||||
instance.termination_b.save()
|
instance.termination_b.save()
|
||||||
|
|
||||||
# Update all endpoints affected by this cable
|
# Update all endpoints affected by this cable
|
||||||
update_endpoints(endpoints)
|
update_endpoints(endpoints, without_cable=instance)
|
||||||
|
|
||||||
|
|
||||||
def update_endpoints(endpoints):
|
def update_endpoints(endpoints, without_cable=None):
|
||||||
"""
|
"""
|
||||||
Update all endpoints affected by this cable
|
Update all endpoints affected by this cable
|
||||||
"""
|
"""
|
||||||
@ -75,6 +75,10 @@ def update_endpoints(endpoints):
|
|||||||
if not hasattr(endpoint, 'connected_endpoint'):
|
if not hasattr(endpoint, 'connected_endpoint'):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
if endpoint.cable == without_cable:
|
||||||
|
# We collected the endpoints before deleting the cable, so trace with the cable removed
|
||||||
|
endpoint.cable = None
|
||||||
|
|
||||||
path = endpoint.trace()
|
path = endpoint.trace()
|
||||||
|
|
||||||
# The trace returns left and right, we just want a single list
|
# The trace returns left and right, we just want a single list
|
||||||
|
Loading…
Reference in New Issue
Block a user