diff options
author | Narayan Desai <desai@mcs.anl.gov> | 2007-01-16 17:01:42 +0000 |
---|---|---|
committer | Narayan Desai <desai@mcs.anl.gov> | 2007-01-16 17:01:42 +0000 |
commit | 4d0b6a85024d10a9b72baf7b8a1da5ada6ee0f5d (patch) | |
tree | b460f80d5555021c632552ab56ec13780078bf4b /src/lib/Client/Tools/RPM.py | |
parent | 36aa72ac90b0a9635fa7b349698d72635809fc00 (diff) | |
download | bcfg2-4d0b6a85024d10a9b72baf7b8a1da5ada6ee0f5d.tar.gz bcfg2-4d0b6a85024d10a9b72baf7b8a1da5ada6ee0f5d.tar.bz2 bcfg2-4d0b6a85024d10a9b72baf7b8a1da5ada6ee0f5d.zip |
Implement more verbose questions for interactive mode (for Packages) (Halfway-resolves Ticket #279)
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@2684 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/lib/Client/Tools/RPM.py')
-rw-r--r-- | src/lib/Client/Tools/RPM.py | 34 |
1 files changed, 25 insertions, 9 deletions
diff --git a/src/lib/Client/Tools/RPM.py b/src/lib/Client/Tools/RPM.py index 3ba5cc0d9..de3f7ca8c 100644 --- a/src/lib/Client/Tools/RPM.py +++ b/src/lib/Client/Tools/RPM.py @@ -37,41 +37,57 @@ class RPM(Bcfg2.Client.Tools.PkgTool): return False rpm_options = [] if entry.get('verify', 'false') == 'nomtime': - self.logger.debug("Skipping mtime verification for package %s" % (entry.get('name'))) + self.logger.debug("Skipping mtime verification for package %s" % \ + (entry.get('name'))) rpm_options.append("--nomtime") if self.installed.has_key(entry.get('name')): if entry.get('version') == self.installed[entry.get('name')]: if entry.get('multiarch'): archs = entry.get('multiarch').split() - info = self.cmd.run('rpm -q %s --qf "%%{NAME} %%{VERSION}-%%{RELEASE} %%{ARCH}\n"' % (entry.get('name')))[1] + info = self.cmd.run( + 'rpm -q %s --qf "%%{NAME} %%{VERSION}-%%{RELEASE} %%{ARCH}\n"' \ + % (entry.get('name')))[1] while info: arch = info.pop().split()[2] if arch in archs: archs.remove(arch) else: - self.logger.error("Got pkg install for Package %s: arch %s" % (entry.get('name'), arch)) + self.logger.error("Got pkg install for Package %s: arch %s" % \ + (entry.get('name'), arch)) return False if archs: - self.logger.error("Package %s not installed for arch: %s" % (entry.get('name'), archs)) + self.logger.error("Package %s not installed for arch: %s" % \ + (entry.get('name'), archs)) return False - if (self.setup['quick'] or (entry.get('verify', 'true') == 'false')) or entry.get('multiarch'): + if (self.setup['quick'] or (entry.get('verify', 'true') == 'false')) \ + or entry.get('multiarch'): if entry.get('verify', 'true') == 'false': - self.logger.debug("Skipping checksum verification for package %s" % (entry.get('name'))) + self.logger.debug("Skipping checksum verification for package %s" % \ + (entry.get('name'))) return True else: self.logger.debug("Package %s: wrong version installed. want %s have %s" % - (entry.get('name'), entry.get('version'), self.installed[entry.get('name')])) + (entry.get('name'), entry.get('version'), + self.installed[entry.get('name')])) entry.set('current_version', self.installed[entry.get('name')]) + entry.set('Upgrade Package %s (%s -> %s)? (y/N) ' % \ + (entry.get('name'), entry.get('current_version'), + entry.get('version'))) return False else: self.logger.debug("Package %s: not installed" % (entry.get('name'))) entry.set('current_exists', 'false') + entry.set('qtext', "Install Package %s-%s? (y/N) " % \ + (entry.get('name'), entry.get('version'))) return False - (vstat, output) = self.cmd.run("rpm --verify -q %s %s-%s" % (" ".join(rpm_options), entry.get('name'), entry.get('version'))) + (vstat, output) = self.cmd.run("rpm --verify -q %s %s-%s" % (" ".join(rpm_options), + entry.get('name'), + entry.get('version'))) if vstat != 0: if [name for name in output if name.split()[-1] not in modlist]: - self.logger.debug("Package %s content verification failed" % entry.get('name')) + self.logger.debug("Package %s content verification failed" % \ + entry.get('name')) return False return True |