mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-26 09:16:10 -06:00
10201 fix add/remove termination
This commit is contained in:
parent
a98984cf9d
commit
cc5f0c9c28
@ -85,7 +85,7 @@ def create_or_rebuild_paths(nodes, in_path):
|
|||||||
if isinstance(nodes[0], PathEndpoint):
|
if isinstance(nodes[0], PathEndpoint):
|
||||||
if in_path:
|
if in_path:
|
||||||
print(f"rebuild_paths1 for: {nodes}")
|
print(f"rebuild_paths1 for: {nodes}")
|
||||||
rebuild_paths(nodes)
|
rebuild_paths(nodes, True)
|
||||||
else:
|
else:
|
||||||
print(f"create_cablepath for: {nodes}")
|
print(f"create_cablepath for: {nodes}")
|
||||||
create_cablepath(nodes)
|
create_cablepath(nodes)
|
||||||
@ -151,6 +151,9 @@ def nullify_connected_endpoints(instance, **kwargs):
|
|||||||
model.objects.filter(pk=instance.termination_id).update(cable=None, cable_end='')
|
model.objects.filter(pk=instance.termination_id).update(cable=None, cable_end='')
|
||||||
|
|
||||||
# for cablepath in CablePath.objects.filter(_nodes__contains=instance.cable):
|
# for cablepath in CablePath.objects.filter(_nodes__contains=instance.cable):
|
||||||
|
# print(f"_nodes before: {cablepath._nodes}")
|
||||||
|
# cablepath._nodes.remove(instance)
|
||||||
|
# print(f"_nodes after: {cablepath._nodes}")
|
||||||
# cablepath.retrace()
|
# cablepath.retrace()
|
||||||
|
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ def create_cablepath(terminations):
|
|||||||
cp.save()
|
cp.save()
|
||||||
|
|
||||||
|
|
||||||
def rebuild_paths(terminations):
|
def rebuild_paths(terminations, endpoint=False):
|
||||||
"""
|
"""
|
||||||
Rebuild all CablePaths which traverse the specified nodes.
|
Rebuild all CablePaths which traverse the specified nodes.
|
||||||
"""
|
"""
|
||||||
@ -58,4 +58,4 @@ def rebuild_paths(terminations):
|
|||||||
for cp in cable_paths:
|
for cp in cable_paths:
|
||||||
cp.dump()
|
cp.dump()
|
||||||
cp.delete()
|
cp.delete()
|
||||||
create_cablepath(cp.origins)
|
create_cablepath(terminations if endpoint else cp.origins)
|
||||||
|
Loading…
Reference in New Issue
Block a user