]> git.proxmox.com Git - mirror_ifupdown2.git/commitdiff
make a copy of the indegrees dict in the graph module
authorroopa <roopa@cumulusnetworks.com>
Thu, 8 May 2014 06:20:04 +0000 (23:20 -0700)
committerroopa <roopa@cumulusnetworks.com>
Thu, 8 May 2014 06:20:04 +0000 (23:20 -0700)
Ticket: CM-2731
Reviewed By:
Testing Done: Tested ifupdown sanity

The graph module modifies the indegrees array and so introduce a copy
of the dict before modifying it.

pkg/graph.py

index 40c834a4da67b054e27d173746919e7d8b7ae9d0..cb2db86f991f6797560680951f85b4b0d1af3d49 100644 (file)
@@ -8,6 +8,7 @@
 #
 
 import logging
+import copy
 from collections import deque
 try:
     from gvgen import *
@@ -21,10 +22,11 @@ class graph():
                     self.__class__.__name__)
 
     @classmethod
-    def topological_sort_graphs_all(cls, dependency_graphs, indegrees):
+    def topological_sort_graphs_all(cls, dependency_graphs, indegrees_arg):
         S = []
         Q = deque()
 
+        indegrees = copy.deepcopy(indegrees_arg)
         for ifname,indegree in indegrees.items():
             if indegree == 0:
                 Q.append(ifname)