From 47a54440f26f6dc5903e304284a1116ab32aa1c3 Mon Sep 17 00:00:00 2001 From: Narayan Desai Date: Thu, 21 Oct 2004 20:12:45 +0000 Subject: fix partial package errors (Logical change 1.105) git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@477 ce84e21b-d406-0410-9b95-82705330c041 --- src/lib/Client/Debian.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/lib/Client/Debian.py b/src/lib/Client/Debian.py index fe1c8266c..305bc4f72 100644 --- a/src/lib/Client/Debian.py +++ b/src/lib/Client/Debian.py @@ -5,11 +5,10 @@ __revision__ = '$Revision$' from copy import deepcopy from os import environ, stat, system from popen2 import Popen4 -from string import join, split import apt_pkg -from Toolset import Toolset +from Bcfg2.Client.Toolset import Toolset def Detect(): try: @@ -54,7 +53,7 @@ class Debian(Toolset): while cstat == -1: output += cmd.fromchild.read() cstat = cmd.poll() >> 8 - if len(filter(lambda x:x, split(output, '\n'))) > num: + if len([x for x in output.split('\n') if x]) > num: return False return True @@ -85,7 +84,7 @@ class Debian(Toolset): while cstat == -1: output += cmd.fromchild.read() cstat = cmd.poll() - output = filter(lambda x:x, split(output, '\n')) + output = [x for x in output.split('\n') if x] if [x for x in output if x not in modlist]: return False return True @@ -134,9 +133,11 @@ class Debian(Toolset): print "Installing" cmd = "apt-get --reinstall -q=2 -y install %s" print "Need to remove:", self.pkgwork['remove'] - print "%s new, %s update, %s remove" % (len(self.pkgwork['add']), len(self.pkgwork['update']), len(self.pkgwork['remove'])) + print "%s new, %s update, %s remove" % (len(self.pkgwork['add']), + len(self.pkgwork['update']), len(self.pkgwork['remove'])) # try single large install - rc = system(cmd%join(map(lambda x:"%s=%s"%(x.attrib['name'], x.attrib['version']), self.pkgwork['add'] + self.pkgwork['update']))) + rc = system(cmd % " ".join(["%s=%s" % (x.attrib['name'], x.attrib.get('version', 'dummy')) for x in + self.pkgwork['add'] + self.pkgwork['update']])) if rc == 0: # set installed to true for pkgtodo for pkg in self.pkgwork['add'] + self.pkgwork['update']: -- cgit v1.2.3-1-g7c22