summaryrefslogtreecommitdiffstats
path: root/src/lib/Client/Toolset.py
diff options
context:
space:
mode:
authorNarayan Desai <desai@mcs.anl.gov>2006-03-09 20:23:35 +0000
committerNarayan Desai <desai@mcs.anl.gov>2006-03-09 20:23:35 +0000
commit5e494a8be31724d0b2f990f60337c83e545d4c1e (patch)
tree89aa1e4b25395b776a41a77d2c33f91fc5e925cc /src/lib/Client/Toolset.py
parent40c0c342fcdd1cea0b9b8972ea539d7368b85f82 (diff)
downloadbcfg2-5e494a8be31724d0b2f990f60337c83e545d4c1e.tar.gz
bcfg2-5e494a8be31724d0b2f990f60337c83e545d4c1e.tar.bz2
bcfg2-5e494a8be31724d0b2f990f60337c83e545d4c1e.zip
* Remove messages describing extra configuration elements when running in bundle mode
* Handle garbage filenames in Cfg more gracefully git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@1799 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/lib/Client/Toolset.py')
-rw-r--r--src/lib/Client/Toolset.py35
1 files changed, 30 insertions, 5 deletions
diff --git a/src/lib/Client/Toolset.py b/src/lib/Client/Toolset.py
index 067f50926..5341d3c84 100644
--- a/src/lib/Client/Toolset.py
+++ b/src/lib/Client/Toolset.py
@@ -5,7 +5,7 @@ from stat import S_ISVTX, S_ISGID, S_ISUID, S_IXUSR, S_IWUSR, S_IRUSR, S_IXGRP
from stat import S_IWGRP, S_IRGRP, S_IXOTH, S_IWOTH, S_IROTH, ST_MODE, S_ISDIR
from stat import S_IFREG, ST_UID, ST_GID, S_ISREG, S_IFDIR, S_ISLNK
-import binascii, copy, grp, logging, lxml.etree, os, popen2, pwd, stat, sys
+import binascii, copy, grp, logging, lxml.etree, os, popen2, pwd, stat, sys, ConfigParser, cStringIO
def calcPerms(initial, perms):
'''This compares ondisk permissions with specified ones'''
@@ -62,6 +62,27 @@ class Toolset(object):
self.VerifyEntry(cfile)
if not self.states[cfile]:
self.InstallConfigFile(cfile)
+ self.statistics = lxml.etree.Element("Statistics")
+ # handle $Revision string processing here
+ cfp = ConfigParser.ConfigParser()
+ cfp.read('/etc/bcfg2.conf')
+ initial = ''
+ try:
+ initial = cfp.get('Specification', 'Revision')
+ except ConfigParser.NoOptionError:
+ pass
+ self.statistics.set('initial', initial)
+ goal = ''
+ upstream = [cfl for cfl in cfg.findall(".//ConfigFile") if cfg.get('name') == '/etc/bcfg2.conf']
+ if upstream:
+ cfp = ConfigParser.ConfigParser()
+ cfp.readfp(cStringIO.StringIO(upstream[0].text))
+ try:
+ goal = cfp.get('Specification', 'Revision')
+ except ConfigParser.NoOptionError:
+ pass
+ if goal != initial:
+ self.logger.info("Specification revision: %s should be upgraded to %s" % (initial, goal))
def saferun(self, command):
'''Run a command in a pipe dealing with stdout buffer overloads'''
@@ -86,7 +107,8 @@ class Toolset(object):
self.logger.info('Correct entries:\t%d' % self.states.values().count(True))
self.logger.info('Incorrect entries:\t%d' % self.states.values().count(False))
self.logger.info('Total managed entries:\t%d' % len(self.states.values()))
- self.logger.info('Unmanaged entries:\t%d' % len(self.pkgwork['remove']))
+ if not self.setup['bundle']:
+ self.logger.info('Unmanaged entries:\t%d' % len(self.pkgwork['remove']))
if ((self.states.values().count(False) > 0) and not self.pkgwork['remove']):
self.logger.info('All entries correct.')
@@ -541,9 +563,12 @@ class Toolset(object):
# Print pass info
self.logger.info("Starting pass %s" % (count))
self.logger.info("%s Entries left" % (len(work)))
- self.logger.info("%s new, %s update, %s remove" %
- (len(self.pkgwork['add']), len(self.pkgwork['update']),
- len(self.pkgwork['remove'])))
+ if self.setup['bundle']:
+ self.logger.info("%s new, %s update" % (len(self.pkgwork['add']), len(self.pkgwork['update'])))
+ else:
+ self.logger.info("%s new, %s update, %s remove" %
+ (len(self.pkgwork['add']), len(self.pkgwork['update']),
+ len(self.pkgwork['remove'])))
# Update counters
count = count + 1