summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorNarayan Desai <desai@mcs.anl.gov>2005-09-28 16:15:34 +0000
committerNarayan Desai <desai@mcs.anl.gov>2005-09-28 16:15:34 +0000
commitf0dd0a89ee8aa5895087761e0aca4f5d051a49f9 (patch)
tree679c8708131e1d8bf98f8481b40510e106be124b /tools
parentf0a29d30bf455ad018173a659b32dcf1b26669f7 (diff)
downloadbcfg2-f0dd0a89ee8aa5895087761e0aca4f5d051a49f9.tar.gz
bcfg2-f0dd0a89ee8aa5895087761e0aca4f5d051a49f9.tar.bz2
bcfg2-f0dd0a89ee8aa5895087761e0aca4f5d051a49f9.zip
do stats as well
(Logical change 1.325) git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@1324 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'tools')
-rw-r--r--tools/upgrade.py24
1 files changed, 23 insertions, 1 deletions
diff --git a/tools/upgrade.py b/tools/upgrade.py
index ece0cb4dd..030dc2988 100644
--- a/tools/upgrade.py
+++ b/tools/upgrade.py
@@ -34,7 +34,29 @@ if __name__ == '__main__':
continue
print hostinfo
- open(cf.get('server', 'metadata') + '/metadata.xml.new'), 'w').write(tostring(metadata))
+ open(cf.get('server', 'metadata') + '/metadata.xml.new', 'w').write(tostring(metadata))
+
+ metadata = XML(open(cf.get('server', 'metadata') + '/statistics.xml').read())
+ for client in metadata.findall('.//Node'):
+ if client.get('name').count('.') == 0:
+ if hostcache.has_key(client.get('name')):
+ client.set('name', "%s.%s" % (client.get('name'), hostcache[client.get('name')]))
+ continue
+ for dom in domainlist:
+ print "resolving name %s.%s..." % (client.get('name'), dom),
+ try:
+ hostinfo = gethostbyname(client.get('name') + '.' + dom)
+ hostcache[client.get('name')] = dom
+ client.set('name', "%s.%s" % (client.get('name'), dom))
+ print ""
+ break
+ except:
+ print "FAILED"
+ continue
+ print hostinfo
+
+ open(cf.get('server', 'metadata') + '/statistics.xml.new', 'w').write(tostring(metadata))
+
sshdir = cf.get('server', 'repository') + '/SSHbase/'
for key in glob(sshdir + "*key*.H_*"):