diff options
author | Narayan Desai <desai@mcs.anl.gov> | 2009-10-22 03:00:08 +0000 |
---|---|---|
committer | Narayan Desai <desai@mcs.anl.gov> | 2009-10-22 03:00:08 +0000 |
commit | 002f89d7f52dd00e995eacb633ce0b36c087f7a5 (patch) | |
tree | e868df38701604ecd563fb68633b62774ded5795 /src/lib | |
parent | f08a3e2d8e2e9729142f792d2665265f3753408e (diff) | |
download | bcfg2-002f89d7f52dd00e995eacb633ce0b36c087f7a5.tar.gz bcfg2-002f89d7f52dd00e995eacb633ce0b36c087f7a5.tar.bz2 bcfg2-002f89d7f52dd00e995eacb633ce0b36c087f7a5.zip |
Packages: Defer handling of virtual requirements provided by multiple
packages until last possible time (now with 100% less wtf ;)
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@5491 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/Server/Plugins/Packages.py | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/src/lib/Server/Plugins/Packages.py b/src/lib/Server/Plugins/Packages.py index 0d71341f7..343fd6f87 100644 --- a/src/lib/Server/Plugins/Packages.py +++ b/src/lib/Server/Plugins/Packages.py @@ -16,6 +16,9 @@ import Bcfg2.Server.Plugin class NoData(Exception): pass +class SomeData(Exception): + pass + logger = logging.getLogger('Packages') def source_from_xml(xsource): @@ -215,8 +218,8 @@ class Source(object): pass return (set([requirement]), deps) - print "wtf man. %s" % requirement - raise NoData + # choice data is here, but not forced by currently resolved requirements + raise SomeData class YUMSource(Source): xp = '{http://linux.duke.edu/metadata/common}' @@ -549,6 +552,9 @@ class Packages(Bcfg2.Server.Plugin.Plugin, unknown = set() examined = set() + final_pass = set() + in_final_pass = False + while needed: # process requirements until all done or no progress current = needed.pop() @@ -562,15 +568,24 @@ class Packages(Bcfg2.Server.Plugin.Plugin, break except NoData: continue + except SomeData: + if not in_final_pass: + final_pass.add(current) except: self.logger.error("Packages: resolve_requirement call failed unexpectedly", exc_info=1) if found: + in_final_pass = False pkgs = pkgs.union(newp) needed = needed.union(newr) needed.difference_update(examined) else: unknown.add(current) + if not needed: + in_final_pass = True + needed.update(final_pass) + final_pass = set() + return pkgs, unknown, ptype.pop() def validate_structures(self, meta, structures): |