diff options
Diffstat (limited to 'src/lib/Client')
-rw-r--r-- | src/lib/Client/Frame.py | 6 | ||||
-rw-r--r-- | src/lib/Client/Tools/APT.py | 7 | ||||
-rw-r--r-- | src/lib/Client/Tools/RPM.py | 34 |
3 files changed, 37 insertions, 10 deletions
diff --git a/src/lib/Client/Frame.py b/src/lib/Client/Frame.py index 222b258f8..91e45d4b8 100644 --- a/src/lib/Client/Frame.py +++ b/src/lib/Client/Frame.py @@ -16,8 +16,12 @@ def promptFilter(prompt, entries): ret = [] entries.sort(cmpent) for entry in entries[:]: + if 'qtext' in entry.attrib: + iprompt = entry.get('qtext') + else: + iprompt = prompt % (entry.tag, entry.get('name')) try: - if raw_input(prompt % (entry.tag, entry.get('name'))) in ['y', 'Y']: + if raw_input(iprompt) in ['y', 'Y']: ret.append(entry) except: continue diff --git a/src/lib/Client/Tools/APT.py b/src/lib/Client/Tools/APT.py index 4c5482208..2dbc3644e 100644 --- a/src/lib/Client/Tools/APT.py +++ b/src/lib/Client/Tools/APT.py @@ -56,6 +56,8 @@ class APT(Bcfg2.Client.Tools.PkgTool): 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'))) return False files = [] for item in output: @@ -72,10 +74,15 @@ class APT(Bcfg2.Client.Tools.PkgTool): self.logger.info("Package %s failed validation. Bad files are:" % \ entry.get('name')) self.logger.info(bad) + entry.set('qtext', + "Reinstall Package %s-%s to fix failing md5sums? (y/N) ") return False return True else: entry.set('current_version', self.installed[entry.get('name')]) + entry.set('qtext', "Upgrade Package %s (%s -> %s)? (y/N) " % \ + (entry.get('name'), entry.get('current_version'), + entry.get('version'))) return False self.logger.info("Package %s not installed" % (entry.get('name'))) entry.set('current_exists', 'false') 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 |