X-Git-Url: http://xvm.mit.edu/gitweb/invirt/packages/invirt-remote.git/blobdiff_plain/919c1347c7978382a2e8e4b947c3d68a84d321b3..4f84d6e9bdc80384ba10ac535870b724c0cf1cf9:/files/usr/sbin/invirt-remote-vnccert diff --git a/files/usr/sbin/invirt-remote-vnccert b/files/usr/sbin/invirt-remote-vnccert index acf2816..019256a 100755 --- a/files/usr/sbin/invirt-remote-vnccert +++ b/files/usr/sbin/invirt-remote-vnccert @@ -1,6 +1,26 @@ -#!/bin/bash -# Get the VNC cert for the host passed as the first argument +#!/usr/bin/python -klist -s || kinit -k +""" +Retrieves the VNC certificate from an Invirt host +""" -exec remctl "$1" remote web vnccert +from invirt.config import structs as config +from subprocess import Popen, call, PIPE +import sys + + +def main(argv): + if len(argv) < 2: + print >> sys.stderr, "usage: invirt-remote-vnccert " + return 2 + + host = argv[1] + + if host not in list(i.hostname for i in config.hosts): + print >> sys.stderr, "Invalid hostname specified" + return 1 + + return call(['remctl', host, 'remote', 'web', 'vnccert']) + +if __name__ == '__main__': + sys.exit(main(sys.argv))