summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Drake <michael.drake@codethink.co.uk>2015-09-11 10:01:55 +0100
committerMichael Drake <michael.drake@codethink.co.uk>2015-09-11 10:01:55 +0100
commit3081f470ff59e7f97679dedc799d9f841c4a9970 (patch)
tree5668bc820cdfd5694452c96c81bcae590d1e97d8
parent443bf7854283b4f317261377d512601ef8850e6a (diff)
downloadciat-tester-3081f470ff59e7f97679dedc799d9f841c4a9970.tar.gz
If no key exists, create one.
-rwxr-xr-xopenstack/tester7
1 files changed, 6 insertions, 1 deletions
diff --git a/openstack/tester b/openstack/tester
index 1643537..221a597 100755
--- a/openstack/tester
+++ b/openstack/tester
@@ -299,7 +299,12 @@ class Deployment(object):
authkeys = os.path.join(tempdir, 'root', '.ssh', 'authorized_keys')
os.makedirs(os.path.dirname(authkeys))
with open(authkeys, 'w') as auth_f:
- with open('/root/.ssh/id_rsa.pub', 'r') as key_f:
+ filename = '/root/.ssh/id_rsa';
+ if not os.path.exists(filename):
+ print("Warning: No key found; generating key");
+ cliapp.runcmd(['ssh-keygen', '-t', 'rsa', '-b', '2048',
+ '-f', filename, '-C', 'test@ciat', '-N', ''])
+ with open(filename + '.pub', 'r') as key_f:
shutil.copyfileobj(key_f, auth_f)
install_files = shlex.split(config.get('INSTALL_FILES', ''))