-TMP_DIR="$(mktemp -d)"
-for i in $(ls /etc/invirt/vnc-cert.d/*.crt); do
- keytool -noprompt -alias "${i%.crt}" -file "/etc/invirt/vnc-cert.d/$i" \
- -keystore "$TMP_DIR/trust.store" -storepass "foobar"
-done
+def main():
+ call(['kinit', '-k', 'daemon/%s' % config.web.hostname])
+
+ shutil.copy('/usr/share/invirt-vnc-client/VncViewer.src.jar',
+ '/usr/share/invirt-vnc-client/VncViewer.jar')
+
+ temp_dir = tempfile.mkdtemp()
+ keystore = os.path.join(temp_dir, 'trust.store')
+ for host in config.hosts:
+ cert = Popen(['remctl', config.remote.hostname, 'web', 'vnccert', host.hostname],
+ stdout=PIPE)
+ cert.wait()
+ call(['keytool', '-import', '-noprompt', '-alias', host.hostname,
+ '-keystore', keystore, '-storepass', 'foobar'],
+ stdin=cert.stdout)
+
+ call(['jar', 'uf', '/usr/share/invirt-vnc-client/VncViewer.jar',
+ '-C', temp_dir, 'trust.store'])
+
+ shutil.rmtree(temp_dir)