summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Drake <michael.drake@codethink.co.uk>2015-09-11 10:00:59 +0100
committerMichael Drake <michael.drake@codethink.co.uk>2015-09-11 10:00:59 +0100
commit443bf7854283b4f317261377d512601ef8850e6a (patch)
treea05cdd9ff1ff5b948ead15e1d97ff9e4c98cddd5
parent304b318d4217154af8aa17feb377e248ab20071e (diff)
downloadciat-tester-443bf7854283b4f317261377d512601ef8850e6a.tar.gz
Ensure directory exists before creating known_hosts.
-rwxr-xr-xopenstack/tester7
1 files changed, 6 insertions, 1 deletions
diff --git a/openstack/tester b/openstack/tester
index 583eb80..1643537 100755
--- a/openstack/tester
+++ b/openstack/tester
@@ -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)