summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Drake <michael.drake@codethink.co.uk>2015-09-08 08:21:30 +0000
committerMichael Drake <michael.drake@codethink.co.uk>2015-09-11 08:50:45 +0000
commit5f1f700819d9dd91900134bdc9fe928580e09cc5 (patch)
tree3b88ebf6eda477c9a16d2699eee8c7a3cb3548f1
parentc45e7195fcdeee739be679844fd48e1006fc6f77 (diff)
downloaddefinitions-5f1f700819d9dd91900134bdc9fe928580e09cc5.tar.gz
Ensure directory exists before creating known_hosts.
-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 583eb80e..16435371 100755
--- a/scripts/release-test-os
+++ b/scripts/release-test-os
@@ -281,7 +281,12 @@ class Deployment(object):
def _update_known_hosts(self):
if not self._ssh_host_key_exists(self.host_machine.address):
- with open('/root/.ssh/known_hosts', 'a') as known_hosts:
+ filename = '/root/.ssh/known_hosts';
+ print("No known_hosts: ensuring path");
+ if not os.path.exists(os.path.dirname(filename)):
+ os.makedirs(os.path.dirname(filename))
+ with open(filename, 'a') as known_hosts:
+ print("Generating known_hosts");
cliapp.runcmd(['ssh-keyscan', self.host_machine.address],
stdout=known_hosts)