From 5f1f700819d9dd91900134bdc9fe928580e09cc5 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Tue, 8 Sep 2015 08:21:30 +0000 Subject: Ensure directory exists before creating known_hosts. --- scripts/release-test-os | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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) -- cgit v1.2.1