Bläddra i källkod

Remove unused follow_circuits arg for cable tracing

Jeremy Stretch 6 år sedan
förälder
incheckning
e143158f12
3 ändrade filer med 6 tillägg och 6 borttagningar
  1. 1 1
      netbox/dcim/api/views.py
  2. 4 4
      netbox/dcim/models/device_components.py
  3. 1 1
      netbox/dcim/views.py

+ 1 - 1
netbox/dcim/api/views.py

@@ -77,7 +77,7 @@ class CableTraceMixin(object):
         # Initialize the path array
         path = []
 
-        for near_end, cable, far_end in obj.trace(follow_circuits=True):
+        for near_end, cable, far_end in obj.trace():
 
             # Serialize each object
             serializer_a = get_serializer_for_model(near_end, prefix='Nested')

+ 4 - 4
netbox/dcim/models/device_components.py

@@ -89,7 +89,7 @@ class CableTermination(models.Model):
     class Meta:
         abstract = True
 
-    def trace(self, follow_circuits=False):
+    def trace(self):
         """
         Return a list representing a complete cable path, with each individual segment represented as a three-tuple:
             [
@@ -102,7 +102,7 @@ class CableTermination(models.Model):
         path = []
         position_stack = []
 
-        def get_peer_port(termination, follow_circuits=False):
+        def get_peer_port(termination):
             from circuits.models import CircuitTermination
 
             # Map a front port to its corresponding rear port
@@ -135,7 +135,7 @@ class CableTermination(models.Model):
                     return None
 
             # Follow a circuit to its other termination
-            elif isinstance(termination, CircuitTermination) and follow_circuits:
+            elif isinstance(termination, CircuitTermination):
                 peer_termination = termination.get_peer_termination()
                 if peer_termination is None:
                     return None
@@ -169,7 +169,7 @@ class CableTermination(models.Model):
             ))
 
             # Get the peer port of the far end termination
-            endpoint = get_peer_port(far_end, follow_circuits)
+            endpoint = get_peer_port(far_end)
             if endpoint is None:
                 return path
 

+ 1 - 1
netbox/dcim/views.py

@@ -2019,7 +2019,7 @@ class CableTraceView(PermissionRequiredMixin, View):
     def get(self, request, model, pk):
 
         obj = get_object_or_404(model, pk=pk)
-        trace = obj.trace(follow_circuits=True)
+        trace = obj.trace()
         total_length = sum([entry[1]._abs_length for entry in trace if entry[1] and entry[1]._abs_length])
 
         return render(request, 'dcim/cable_trace.html', {