jeremystretch 3 лет назад
Родитель
Сommit
9d35a9d912

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

@@ -205,14 +205,14 @@ class PathEndpoint(models.Model):
             while (len(path)) % 3:
                 # Pad to ensure we have complete three-tuples (e.g. for paths that end at a non-connected FrontPort)
                 # by inserting empty entries immediately prior to the path's destination node(s)
-                path.insert(-1, [None])
+                path.append([])
 
             # TODO: Add bridging support
             # # Check for bridge interface to continue the trace
             # origin = getattr(origin._path.destination, 'bridge', None)
             origin = None
 
-        # Return the path as a list of three-tuples (A termination, cable, B termination)
+        # Return the path as a list of three-tuples (A termination(s), cable(s), B termination(s))
         return list(zip(*[iter(path)] * 3))
 
     def get_trace_svg(self, base_url=None, width=None):

+ 0 - 2
netbox/dcim/models/racks.py

@@ -429,7 +429,6 @@ class Rack(NetBoxModel):
         """
         powerfeeds = PowerFeed.objects.filter(rack=self)
         available_power_total = sum(pf.available_power for pf in powerfeeds)
-        print(f'available_power_total: {available_power_total}')
         if not available_power_total:
             return 0
 
@@ -442,7 +441,6 @@ class Rack(NetBoxModel):
         allocated_draw = 0
         for powerport in powerports:
             allocated_draw += powerport.get_power_draw()['allocated']
-        print(f'allocated_draw: {allocated_draw}')
 
         return int(allocated_draw / available_power_total * 100)
 

+ 3 - 3
netbox/dcim/svg/cables.py

@@ -321,7 +321,7 @@ class CableTraceSVG:
 
         # Iterate through each (terms, cable, terms) segment in the path
         for i, segment in enumerate(traced_path):
-            near_ends, link, far_ends = segment
+            near_ends, links, far_ends = segment
 
             # Near end parent
             if i == 0:
@@ -332,8 +332,8 @@ class CableTraceSVG:
             terminations = self.draw_terminations(near_ends)
 
             # Connector (a Cable or WirelessLink)
-            link = link[0]  # Remove Cable from list
-            if link is not None:
+            if links:
+                link = links[0]  # Remove Cable from list
 
                 # Cable
                 if type(link) is Cable: