From b5a0f5fb9b4dbe999395777a13b0f1dc85c75c3d Mon Sep 17 00:00:00 2001 From: Daniel Joseph Barnhart Clark Date: Fri, 6 Jul 2007 05:36:57 +0000 Subject: Added debugging when verify or install fails due to lack of an attribute. git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@3421 ce84e21b-d406-0410-9b95-82705330c041 --- src/lib/Client/Tools/__init__.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/lib/Client/Tools/__init__.py b/src/lib/Client/Tools/__init__.py index 1ab656481..5105a68f4 100644 --- a/src/lib/Client/Tools/__init__.py +++ b/src/lib/Client/Tools/__init__.py @@ -2,8 +2,8 @@ __revision__ = '$Revision$' __all__ = ["Action", "APT", "Blast", "Chkconfig", "DebInit", "Encap", - "FreeBSDPackage", "launchd", "Portage", "POSIX", "RPM", - "RPMng", 'rpmtools', "RcUpdate", "SMF", "SYSV", "Yum", + "FreeBSDPackage", "launchd", "Portage", "POSIX", "RPM", + "RPMng", 'rpmtools', "RcUpdate", "SMF", "SYSV", "Yum", "YUMng"] drivers = [item for item in __all__ if item not in ['rpmtools']] @@ -37,7 +37,7 @@ class executor: '''this class runs stuff for us''' def __init__(self, logger): self.logger = logger - + def run(self, command): '''Run a command in a pipe dealing with stdout buffer overloads''' self.logger.debug('> %s' % command) @@ -69,7 +69,7 @@ class Tool: __handles__ = [] __req__ = {} __important__ = [] - + def __init__(self, logger, setup, config, states): self.setup = setup self.logger = logger @@ -140,7 +140,7 @@ class Tool: '''return a list of supported entries''' return [entry for struct in self.config.getchildren() for entry in struct.getchildren() \ if self.handlesEntry(entry)] - + def handlesEntry(self, entry): '''return if entry is handled by this Tool''' return (entry.tag, entry.get('type')) in self.__handles__ @@ -156,10 +156,11 @@ class Tool: '''test if entry has enough information to be verified''' if not self.handlesEntry(entry): return False - + if [attr for attr in self.__req__[entry.tag] if attr not in entry.attrib]: self.logger.error("Incomplete information for entry %s:%s; cannot verify" \ % (entry.tag, entry.get('name'))) + self.logger.debug("\t... due to absense of %s attribute" % attr) return False return True @@ -175,9 +176,10 @@ class Tool: if [attr for attr in self.__ireq__[entry.tag] if attr not in entry.attrib]: self.logger.error("Incomplete information for entry %s:%s; cannot install" \ % (entry.tag, entry.get('name'))) + self.logger.debug("\t... due to absense of %s attribute" % attr) return False return True - + class PkgTool(Tool): '''PkgTool provides a one-pass install with fallback for use with packaging systems''' pkgtool = ('echo %s', ('%s', ['name'])) @@ -194,7 +196,7 @@ class PkgTool(Tool): def VerifyPackage(self, dummy, _): '''Dummy verification method''' return False - + def Install(self, packages): '''Run a one-pass install, followed by single pkg installs in case of failure''' self.logger.info("Trying single pass package install for pkgtype %s" % \ -- cgit v1.2.3-1-g7c22