X-Git-Url: http://xvm.mit.edu/gitweb/invirt/packages/invirt-console.git/blobdiff_plain/d608605a88e3aa44bd55ef01e6bf333447971b85..2cc348782375d7b1437183ea4dcb506f2d4e0497:/files/usr/sbin/sipb-xen-update-conserver diff --git a/files/usr/sbin/sipb-xen-update-conserver b/files/usr/sbin/sipb-xen-update-conserver index 9201024..1fc623b 100755 --- a/files/usr/sbin/sipb-xen-update-conserver +++ b/files/usr/sbin/sipb-xen-update-conserver @@ -3,6 +3,7 @@ import sipb_xen_database import subprocess import os +import socket sipb_xen_database.connect('postgres://sipb-xen@sipb-xen-dev.mit.edu/sipb_xen') @@ -18,7 +19,16 @@ def reload_conserver(): p.wait() if __name__ == '__main__': + hostname = socket.getfqdn().lower() + realm = file('/etc/invirt/realm').read().strip() + principal = 'host/'+hostname+'@'+realm + config = '\n'.join('console %s { master %s; }' % (vm, hostname) + for vm in live_vms()) f = open('/etc/conserver/sipb-xen-consoles.cf', 'w') - f.write('\n'.join('console %s {}' % vm for vm in live_vms())) + f.write(config) 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])