summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNarayan Desai <desai@mcs.anl.gov>2007-01-16 17:01:42 +0000
committerNarayan Desai <desai@mcs.anl.gov>2007-01-16 17:01:42 +0000
commit4d0b6a85024d10a9b72baf7b8a1da5ada6ee0f5d (patch)
treeb460f80d5555021c632552ab56ec13780078bf4b
parent36aa72ac90b0a9635fa7b349698d72635809fc00 (diff)
downloadbcfg2-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
-rw-r--r--src/lib/Client/Frame.py6
-rw-r--r--src/lib/Client/Tools/APT.py7
-rw-r--r--src/lib/Client/Tools/RPM.py34
-rw-r--r--src/lib/Server/Component.py3
4 files changed, 38 insertions, 12 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
diff --git a/src/lib/Server/Component.py b/src/lib/Server/Component.py
index 1a159282c..00d17f86c 100644
--- a/src/lib/Server/Component.py
+++ b/src/lib/Server/Component.py
@@ -148,8 +148,7 @@ class Component(SSLServer,
self.port = self.socket.getsockname()[1]
self.url = "https://%s:%s" % (socket.gethostname(), self.port)
self.logger.info("Bound to port %s" % self.port)
- self.funcs.update({'HandleEvents':self.HandleEvents,
- 'system.listMethods':self.addr_system_listMethods})
+ self.funcs.update({'system.listMethods':self.addr_system_listMethods})
self.atime = 0
self.assert_location()
atexit.register(self.deassert_location)