From 4f5f13afe4f7732582f9c1d407b26fee906afc96 Mon Sep 17 00:00:00 2001 From: Narayan Desai Date: Fri, 16 Sep 2005 15:52:56 +0000 Subject: get solaris changes all working 2005/09/15 13:27:36-05:00 anl.gov!desai make unbound configfiles return a reasonable error message, not a traceback (Logical change 1.316) git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@1293 ce84e21b-d406-0410-9b95-82705330c041 --- src/lib/Client/Toolset.py | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'src/lib/Client') diff --git a/src/lib/Client/Toolset.py b/src/lib/Client/Toolset.py index 0e5f513e2..9f759d733 100644 --- a/src/lib/Client/Toolset.py +++ b/src/lib/Client/Toolset.py @@ -329,6 +329,10 @@ class Toolset(object): def InstallConfigFile(self, entry): '''Install ConfigFile Entry''' + if entry.text == None: + self.CondPrint('verbose', + "Incomplete information for ConfigFile %s. Cannot install" % (entry.get('name'))) + return False self.CondPrint('verbose', "Installing ConfigFile %s" % (entry.get('name'))) if self.setup['dryrun']: @@ -497,8 +501,9 @@ class Toolset(object): packages = [pkg for pkg in work if pkg.tag == 'Package'] ptypes = [] - [ptypes.append(ptype) for ptype in [pkg.get('type') for pkg in packages] - if pkg.get('type') not in ptypes] + for pkg in packages: + if pkg.get('type') not in ptypes: + ptypes.append(pkg.get('type')) if packages: for pkgtype in ptypes: # try single large install @@ -508,9 +513,16 @@ class Toolset(object): continue pkgtool = self.pkgtool[pkgtype] pkglist = [pkg for pkg in packages if pkg.get('type') == pkgtype] - pkgargs = " ".join([pkgtool[1][0] % tuple([pkg.get(field, '') for field in pkgtool[1][1]]) + for field in pkgtool[1][1]: + pkglist = [pkg for pkg in pkglist if pkg.attrib.has_key(field)] + if not pkglist: + self.CondPrint("debug", "No complete/installable packages of type %s" % pkgtype) + continue + pkgargs = " ".join([pkgtool[1][0] % tuple([pkg.get(field) for field in pkgtool[1][1]]) for pkg in pkglist]) - self.CondPrint("debug", "Installing packages: %s" % pkgargs) + + self.CondPrint("debug", "Installing packages: :%s:" % pkgargs) + self.CondPrint("debug", "Running command ::%s::" % (pkgtool[0] % pkgargs)) cmdrc = system(pkgtool[0] % pkgargs) if cmdrc == 0: -- cgit v1.2.3-1-g7c22