From 1a2fbced68eaf6bb01d6dee6a4223c7368095137 Mon Sep 17 00:00:00 2001 From: Sol Jerome Date: Sun, 21 Dec 2008 21:01:36 +0000 Subject: Warn on missing bundles when using -b (Resolves Ticket #615) [bugfix] git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@4997 ce84e21b-d406-0410-9b95-82705330c041 --- src/lib/Client/Frame.py | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/lib/Client/Frame.py b/src/lib/Client/Frame.py index 71c4addc8..014a1cf16 100644 --- a/src/lib/Client/Frame.py +++ b/src/lib/Client/Frame.py @@ -1,4 +1,7 @@ -'''Frame is the Client Framework that verifies and installs entries, and generates statistics''' +""" +Frame is the Client Framework that verifies and +installs entries, and generates statistics +""" __revision__ = '$Revision$' import logging, time, types @@ -78,7 +81,8 @@ class Frame: except Bcfg2.Client.Tools.toolInstantiationError: continue except: - self.logger.error("Failed to instantiate tool %s" % (tool), exc_info=1) + self.logger.error("Failed to instantiate tool %s" % \ + (tool), exc_info=1) for tool in self.tools[:]: for conflict in getattr(tool, 'conflicts', []): @@ -90,7 +94,7 @@ class Frame: if not self.dryrun and not self.setup['bundle']: for cfile in [cfl for cfl in config.findall(".//ConfigFile") \ if cfl.get('name') in self.__important__]: - tl= [t for t in self.tools if t.handlesEntry(cfile) \ + tl = [t for t in self.tools if t.handlesEntry(cfile) \ and t.canVerify(cfile)] if tl: if not tl[0].VerifyConfigFile(cfile, []): @@ -103,7 +107,8 @@ class Frame: self.logger.error("Unexpected tool failure", exc_info=1) # find entries not handled by any tools - problems = [entry for struct in config for entry in struct if entry not in self.handled] + problems = [entry for struct in config for \ + entry in struct if entry not in self.handled] if problems: self.logger.error("The following entries are not handled by any tool:") @@ -191,6 +196,12 @@ class Frame: # Here is where most of the work goes # first perform bundle filtering if self.setup['bundle']: + all_bundle_names = [b.get('name') for b in + self.config.findall('./Bundle')] + # warn if non-existent bundle given + for bundle in self.setup['bundle']: + if bundle not in all_bundle_names: + self.logger.info("Warning: Bundle %s not found" % bundle) bundles = [b for b in self.config.findall('./Bundle') \ if b.get('name') in self.setup['bundle']] self.whitelist = [e for e in self.whitelist if \ -- cgit v1.2.3-1-g7c22