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

Fixes #2683: Fix exception when connecting a cable to a RearPort with no corresponding FrontPort

This commit is contained in:
Jeremy Stretch
2018-12-12 16:40:34 -05:00
parent edd763b1aa
commit 0d3b1bfca4
3 changed files with 15 additions and 9 deletions

View File

@@ -37,7 +37,7 @@ def update_connected_endpoints(instance, **kwargs):
# Check if this Cable has formed a complete path. If so, update both endpoints.
endpoint_a, endpoint_b, path_status = instance.get_path_endpoints()
if endpoint_a is not None and endpoint_b is not None:
if hasattr(endpoint_a, 'connected_endpoint') and hasattr(endpoint_b, 'connected_endpoint'):
endpoint_a.connected_endpoint = endpoint_b
endpoint_a.connection_status = path_status
endpoint_a.save()
@@ -62,7 +62,7 @@ def nullify_connected_endpoints(instance, **kwargs):
instance.termination_b.save()
# If this Cable was part of a complete path, tear it down
if endpoint_a is not None and endpoint_b is not None:
if hasattr(endpoint_a, 'connected_endpoint') and hasattr(endpoint_b, 'connected_endpoint'):
endpoint_a.connected_endpoint = None
endpoint_a.connection_status = None
endpoint_a.save()