Don't proxy requests for the VNC cert if the requested hostname isn't
[invirt/packages/invirt-remote.git] / files / usr / sbin / invirt-remote-vnccert
1 #!/usr/bin/python
2
3 """
4 Retrieves the VNC certificate from an Invirt host
5 """
6
7 from invirt.config import structs as config
8 from subprocess import Popen, call, PIPE
9 import sys
10
11
12 def main(argv):
13     if len(argv) < 2:
14         print >> sys.stderr, "usage: invirt-remote-vnccert <host>"
15         return 2
16     
17     host = argv[1]
18     
19     if host not in list(i.hostname for i in config.hosts):
20         print >> sys.stderr, "Invalid hostname specified"
21         return 1
22     
23     return call(['remctl', host, 'remote', 'web', 'vnccert'])
24
25 if __name__ == '__main__':
26     sys.exit(main(sys.argv))