Last change
on this file since 1959 was
1836,
checked in by broder, 16 years ago
|
config.{authn[0] => kerberos}.realm
|
-
Property svn:executable set to
*
|
File size:
1.1 KB
|
Rev | Line | |
---|
[397] | 1 | #!/usr/bin/python |
---|
[386] | 2 | |
---|
[397] | 3 | import subprocess |
---|
| 4 | import os |
---|
[672] | 5 | import socket |
---|
[811] | 6 | from invirt.config import structs as config |
---|
[397] | 7 | |
---|
| 8 | def live_vms(): |
---|
[403] | 9 | p = subprocess.Popen(['/usr/sbin/xm', 'list'], stdout=subprocess.PIPE) |
---|
[397] | 10 | p.wait() |
---|
| 11 | output = p.stdout.read() |
---|
| 12 | vms = [x.split()[0][2:] for x in output.splitlines() if x.startswith('d_')] |
---|
| 13 | return vms |
---|
| 14 | |
---|
| 15 | def reload_conserver(): |
---|
[1539] | 16 | p = subprocess.Popen(['/usr/sbin/invoke-rc.d', 'conserver-server', 'reload'], stdout=subprocess.PIPE) |
---|
[397] | 17 | p.wait() |
---|
| 18 | |
---|
| 19 | if __name__ == '__main__': |
---|
[672] | 20 | hostname = socket.getfqdn().lower() |
---|
[1836] | 21 | realm = config.kerberos.realm |
---|
[706] | 22 | principal = 'host/'+hostname+'@'+realm |
---|
[813] | 23 | conftext = '\n'.join('console %s { master %s; }' % (vm, hostname) |
---|
| 24 | for vm in live_vms()) |
---|
[1187] | 25 | f = open('/etc/conserver/invirt-consoles.cf', 'w') |
---|
[813] | 26 | f.write(conftext) |
---|
[397] | 27 | f.close() |
---|
| 28 | reload_conserver() |
---|
[672] | 29 | subprocess.call(['/usr/bin/kinit', '-k', '-t', '/etc/krb5.keytab', |
---|
[706] | 30 | principal]) |
---|
[813] | 31 | subprocess.call(['/usr/bin/remctl', config.console.hostname, |
---|
| 32 | 'console', 'update', conftext]) |
---|
Note: See
TracBrowser
for help on using the repository browser.