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

Fixes #4548: Fix tracing cables through a single RearPort

This commit is contained in:
Jeremy Stretch
2020-04-29 16:32:30 -04:00
parent 81ffa0811e
commit bcb7899b04
3 changed files with 49 additions and 4 deletions

View File

@@ -123,11 +123,12 @@ class CableTermination(models.Model):
# Map a rear port/position to its corresponding front port
elif isinstance(termination, RearPort):
# Can't map to a FrontPort without a position
if not position_stack:
# Can't map to a FrontPort without a position if there are multiple options
if termination.positions > 1 and not position_stack:
raise CableTraceSplit(termination)
position = position_stack.pop()
# We can assume position 1 if the RearPort has only one position
position = position_stack.pop() if position_stack else 1
# Validate the position
if position not in range(1, termination.positions + 1):