From cd89c695f97789e9f04a9eb849e83609249e9ee3 Mon Sep 17 00:00:00 2001 From: Narayan Desai Date: Fri, 14 Jul 2006 16:10:43 +0000 Subject: Improvements to the Deps plugin * Handle recursive dependencies properly (ChrisV) * Fix raise of PluginExecutionError git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@1943 ce84e21b-d406-0410-9b95-82705330c041 --- src/lib/Server/Plugins/Deps.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/lib/Server/Plugins/Deps.py b/src/lib/Server/Plugins/Deps.py index 945c53e70..c2de2d406 100644 --- a/src/lib/Server/Plugins/Deps.py +++ b/src/lib/Server/Plugins/Deps.py @@ -65,7 +65,9 @@ class Deps(Bcfg2.Server.Plugin.PrioDir): else: [src.Cache(metadata) for src in self.entries.values()] - for entry in entries: + toexamine = entries[:] + while toexamine: + entry = toexamine.pop() matching = [src for src in self.entries.values() if src.cache and src.cache[1].has_key(entry[0]) and src.cache[1][entry[0]].has_key(entry[1])] @@ -74,15 +76,16 @@ class Deps(Bcfg2.Server.Plugin.PrioDir): if prio.count(max(prio)) > 1: self.logger.error("Found conflicting %s sources with same priority for %s, pkg %s" % (entry[0].lower(), metadata.hostname, entry[1])) - raise PluginExecutionError + raise Bcfg2.Server.Plugin.PluginExecutionError index = prio.index(max(prio)) matching = [matching[index]] if not matching: continue elif len(matching) == 1: - for prq in src.cache[1][entry[0]][entry[1]]: - if prq not in prereqs: + for prq in matching[0].cache[1][entry[0]][entry[1]]: + if prq not in prereqs and prq not in entries: + toexamine.append(prq) prereqs.append(prq) self.cache[(entries, gdata)] = prereqs -- cgit v1.2.3-1-g7c22