import socket
from invirt.config import structs as config
-sipb_xen_database.connect('postgres://sipb-xen@sipb-xen-dev.mit.edu/sipb_xen')
+sipb_xen_database.connect(config.db.uri)
def live_vms():
p = subprocess.Popen(['/usr/sbin/xm', 'list'], stdout=subprocess.PIPE)
hostname = socket.getfqdn().lower()
realm = config.authn[0].realm
principal = 'host/'+hostname+'@'+realm
- config = '\n'.join('console %s { master %s; }' % (vm, hostname)
- for vm in live_vms())
+ conftext = '\n'.join('console %s { master %s; }' % (vm, hostname)
+ for vm in live_vms())
f = open('/etc/conserver/sipb-xen-consoles.cf', 'w')
- f.write(config)
+ f.write(conftext)
f.close()
reload_conserver()
subprocess.call(['/usr/bin/kinit', '-k', '-t', '/etc/krb5.keytab',
principal])
- subprocess.call(['/usr/bin/remctl', 'sipb-xen-console.mit.edu',
- 'console', 'update', config])
+ subprocess.call(['/usr/bin/remctl', config.console.hostname,
+ 'console', 'update', conftext])