mirror of
				https://github.com/CumulusNetworks/ifupdown2.git
				synced 2024-05-06 15:54:50 +00:00 
			
		
		
		
	make a copy of the indegrees dict in the graph module
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.
This commit is contained in:
		@@ -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)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user