From 43984bc5ebc59bd8c5890ed6ba3de162e6698dcc Mon Sep 17 00:00:00 2001 From: "Chris St. Pierre" Date: Tue, 12 Feb 2013 16:02:24 -0500 Subject: better Executor class for client tools --- src/lib/Bcfg2/Client/Tools/APT.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'src/lib/Bcfg2/Client/Tools/APT.py') diff --git a/src/lib/Bcfg2/Client/Tools/APT.py b/src/lib/Bcfg2/Client/Tools/APT.py index 879d2720a..0cdefa613 100644 --- a/src/lib/Bcfg2/Client/Tools/APT.py +++ b/src/lib/Bcfg2/Client/Tools/APT.py @@ -59,7 +59,8 @@ class APT(Bcfg2.Client.Tools.Tool): os.environ["DEBIAN_FRONTEND"] = 'noninteractive' self.actions = {} if self.setup['kevlar'] and not self.setup['dryrun']: - self.cmd.run("%s --force-confold --configure --pending" % self.dpkg) + self.cmd.run("%s --force-confold --configure --pending" % + self.dpkg) self.cmd.run("%s clean" % self.aptget) try: self.pkg_cache = apt.cache.Cache() @@ -88,13 +89,15 @@ class APT(Bcfg2.Client.Tools.Tool): for (name, version) in extras] def VerifyDebsums(self, entry, modlist): - output = self.cmd.run("%s -as %s" % (self.debsums, - entry.get('name')))[1] + output = \ + self.cmd.run("%s -as %s" % + (self.debsums, entry.get('name'))).stdout.splitlines() if len(output) == 1 and "no md5sums for" in output[0]: self.logger.info("Package %s has no md5sums. Cannot verify" % \ entry.get('name')) - entry.set('qtext', "Reinstall Package %s-%s to setup md5sums? (y/N) " \ - % (entry.get('name'), entry.get('version'))) + entry.set('qtext', + "Reinstall Package %s-%s to setup md5sums? (y/N) " % + (entry.get('name'), entry.get('version'))) return False files = [] for item in output: @@ -250,8 +253,7 @@ class APT(Bcfg2.Client.Tools.Tool): self.logger.error(bad_pkgs) if not ipkgs: return - rc = self.cmd.run(self.pkgcmd % (" ".join(ipkgs)))[0] - if rc: + if not self.cmd.run(self.pkgcmd % (" ".join(ipkgs))): self.logger.error("APT command failed") self.pkg_cache = apt.cache.Cache() self.extra = self.FindExtra() -- cgit v1.2.3-1-g7c22