summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Drake <michael.drake@codethink.co.uk>2015-09-08 08:23:46 +0000
committerMichael Drake <michael.drake@codethink.co.uk>2015-09-11 08:50:45 +0000
commitd7175c9d21db61ce2e8cc89c169f222e679079b4 (patch)
tree126e3cddb724df92917423acb941ef3be3339adf
parent5f1f700819d9dd91900134bdc9fe928580e09cc5 (diff)
downloaddefinitions-d7175c9d21db61ce2e8cc89c169f222e679079b4.tar.gz
If no key exists, create one.
-rwxr-xr-xscripts/release-test-os7
1 files changed, 6 insertions, 1 deletions
diff --git a/scripts/release-test-os b/scripts/release-test-os
index 16435371..221a597f 100755
--- a/scripts/release-test-os
+++ b/scripts/release-test-os
@@ -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', ''))