1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Fixes #10217: Handle exception when trace splits to multiple rear ports

This commit is contained in:
jeremystretch
2022-08-31 10:07:10 -04:00
parent 815b2d8a2b
commit 5ef2d1d7ad
2 changed files with 20 additions and 12 deletions

View File

@@ -677,6 +677,12 @@ class CablePath(models.Model):
"""
Return all available next segments in a split cable path.
"""
rearports = self.path_objects[-1]
nodes = self.path_objects[-1]
return FrontPort.objects.filter(rear_port__in=rearports)
# RearPort splitting to multiple FrontPorts with no stack position
if type(nodes[0]) is RearPort:
return FrontPort.objects.filter(rear_port__in=nodes)
# Cable terminating to multiple FrontPorts mapped to different
# RearPorts connected to different cables
elif type(nodes[0]) is FrontPort:
return RearPort.objects.filter(pk__in=[fp.rear_port_id for fp in nodes])