summaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
authorNarayan Desai <desai@mcs.anl.gov>2006-03-01 19:37:48 +0000
committerNarayan Desai <desai@mcs.anl.gov>2006-03-01 19:37:48 +0000
commit2ac8372b640b10bd649e7ff618ae2f0f3e294b76 (patch)
treed2ebfa094d6e28cfb39415cf39b012e23438d411 /src/lib
parentd81a2a591052537d6161bf95671ac815cdf52a69 (diff)
downloadbcfg2-2ac8372b640b10bd649e7ff618ae2f0f3e294b76.tar.gz
bcfg2-2ac8372b640b10bd649e7ff618ae2f0f3e294b76.tar.bz2
bcfg2-2ac8372b640b10bd649e7ff618ae2f0f3e294b76.zip
Fix up logging in dryrun mode
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@1785 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/Client/Redhat.py5
-rw-r--r--src/lib/Client/Toolset.py29
2 files changed, 20 insertions, 14 deletions
diff --git a/src/lib/Client/Redhat.py b/src/lib/Client/Redhat.py
index d7b28c6fe..6025a8236 100644
--- a/src/lib/Client/Redhat.py
+++ b/src/lib/Client/Redhat.py
@@ -32,7 +32,8 @@ class ToolsetImpl(Toolset):
'''Refresh memory hashes of packages'''
self.installed = {}
for line in self.saferun("rpm -qa --qf '%{NAME} %{VERSION}-%{RELEASE}\n'")[1]:
- [self.installed.update({name:version}) for (name, version) in line.split(' ')]
+ (name, version) = line.split()
+ self.installed[name] = version
def VerifyService(self, entry):
'''Verify Service status for entry'''
@@ -99,7 +100,7 @@ class ToolsetImpl(Toolset):
def HandleExtra(self):
'''Deal with extra configuration detected'''
- if len(self.pkgwork) > 0:
+ if len(self.pkgwork['remove']) > 0:
if self.setup['remove'] in ['all', 'packages']:
self.logger.info("Removing packages: %s" % self.pkgwork['remove'])
if not self.saferun("rpm --quiet -e %s" % " ".join(self.pkgwork['remove']))[0]:
diff --git a/src/lib/Client/Toolset.py b/src/lib/Client/Toolset.py
index 0a6022383..067f50926 100644
--- a/src/lib/Client/Toolset.py
+++ b/src/lib/Client/Toolset.py
@@ -501,18 +501,23 @@ class Toolset(object):
self.HandleExtra()
if self.setup['dryrun']:
- self.logger.info("Packages to update:")
- self.logger.info([pkg.get('name') for pkg in self.pkgwork['update']])
- self.logger.info("Packages to add:")
- self.logger.info([pkg.get('name') for pkg in self.pkgwork['add']])
- self.logger.info("Packages to remove:")
- self.logger.info(self.pkgwork['remove'])
- self.logger.info("Entries to update:")
- self.logger.info(["%s: %s" % (entry.tag, entry.get('name'))
- for entry in self.states if not (self.states[entry]
- or entry.tag == 'Package')])
- self.logger.info("Services to remove:")
- self.logger.info(self.extra_services)
+ if self.pkgwork['update']:
+ self.logger.info("Packages to update:")
+ self.logger.info([pkg.get('name') for pkg in self.pkgwork['update']])
+ if self.pkgwork['add']:
+ self.logger.info("Packages to add:")
+ self.logger.info([pkg.get('name') for pkg in self.pkgwork['add']])
+ if self.pkgwork['remove']:
+ self.logger.info("Packages to remove:")
+ self.logger.info(self.pkgwork['remove'])
+ if [entry for entry in self.states if not (self.states[entry] or entry.tag == 'Package')]:
+ self.logger.info("Entries to update:")
+ self.logger.info(["%s: %s" % (entry.tag, entry.get('name'))
+ for entry in self.states if not (self.states[entry]
+ or entry.tag == 'Package')])
+ if self.extra_services:
+ self.logger.info("Services to remove:")
+ self.logger.info(self.extra_services)
return
# use quick package ops from here on