X-Git-Url: http://xvm.mit.edu/gitweb/invirt/packages/invirt-console.git/blobdiff_plain/fc5ce57debed166529e11d331fec8f6fc2b7ecc4..090aa4c98a7cb685a21784fe225c9ea9af4510ee:/files/usr/sbin/sipb-xen-update-conserver?ds=inline diff --git a/files/usr/sbin/sipb-xen-update-conserver b/files/usr/sbin/sipb-xen-update-conserver index 1d3580b..8d99d64 100755 --- a/files/usr/sbin/sipb-xen-update-conserver +++ b/files/usr/sbin/sipb-xen-update-conserver @@ -4,8 +4,9 @@ import sipb_xen_database import subprocess import os 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) @@ -20,13 +21,15 @@ def reload_conserver(): if __name__ == '__main__': hostname = socket.getfqdn().lower() - config = '\n'.join('console %s { master %s; }' % (vm, hostname) - for vm in live_vms()) + realm = config.authn[0].realm + principal = 'host/'+hostname+'@'+realm + 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', - 'host/'+hostname+'@ATHENA.MIT.EDU']) - subprocess.call(['/usr/bin/remctl', 'sipb-xen-console.mit.edu', - 'console', 'update', config]) + principal]) + subprocess.call(['/usr/bin/remctl', config.console.hostname, + 'console', 'update', conftext])