summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNarayan Desai <desai@mcs.anl.gov>2006-09-15 16:03:02 +0000
committerNarayan Desai <desai@mcs.anl.gov>2006-09-15 16:03:02 +0000
commitc7551ef6d3318e898cf01be926e92b24131a8487 (patch)
treebe4548b604a5311b8f3fd0f9024118d02dca0cc8
parentf7146b07e3dda92ef7dd80dba2f1a7252d86375f (diff)
downloadbcfg2-c7551ef6d3318e898cf01be926e92b24131a8487.tar.gz
bcfg2-c7551ef6d3318e898cf01be926e92b24131a8487.tar.bz2
bcfg2-c7551ef6d3318e898cf01be926e92b24131a8487.zip
Remove old fqdn convertor; it isn't needed any more
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@2267 ce84e21b-d406-0410-9b95-82705330c041
-rw-r--r--tools/upgrade.py73
1 files changed, 0 insertions, 73 deletions
diff --git a/tools/upgrade.py b/tools/upgrade.py
deleted file mode 100644
index 030dc2988..000000000
--- a/tools/upgrade.py
+++ /dev/null
@@ -1,73 +0,0 @@
-#!/usr/bin/env python
-
-'''This script updates to fully qualified hostnames for 0.6.11'''
-__revision__ = '$Revision:$'
-
-from ConfigParser import ConfigParser
-from elementtree.ElementTree import XML, tostring
-from socket import gethostbyname
-from sys import argv
-from glob import glob
-from os import system
-
-if __name__ == '__main__':
- hostcache = {}
- if len(argv) > 1:
- domainlist = argv[-1].split(':')
- else:
- domainlist = ['mcs.anl.gov']
- cf = ConfigParser()
- cf.read(['/etc/bcfg2.conf'])
- metadata = XML(open(cf.get('server', 'metadata') + '/metadata.xml').read())
- for client in metadata.findall('.//Client'):
- if client.get('name').count('.') == 0:
- 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') + '/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_*"):
- hostname = key.split('.H_')[1]
- if not hostcache.has_key(hostname):
- for dom in domainlist:
- try:
- hostinfo = gethostbyname(hostname + '.' + dom)
- hostcache[hostname] = dom
- break
- except:
- continue
- if hostcache.has_key(hostname):
- system("mv %s %s.%s" % (key, key, hostcache[hostname]))