diff options
author | Michael Drake <michael.drake@codethink.co.uk> | 2015-09-11 10:10:03 +0100 |
---|---|---|
committer | Michael Drake <michael.drake@codethink.co.uk> | 2015-09-11 15:01:30 +0100 |
commit | b86407668bd51a5a0b5cdabbec6cd62063c3ddd3 (patch) | |
tree | c97faa917dea111aa68ea059f5ab5e04c1cb1c83 | |
parent | 168fe14060aebfa5639819892ba1d403ac63cf22 (diff) | |
download | ciat-tester-b86407668bd51a5a0b5cdabbec6cd62063c3ddd3.tar.gz |
Allow to run as non-root user.
-rwxr-xr-x | openstack/tester | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/openstack/tester b/openstack/tester index 3add6c5..e4c57cd 100755 --- a/openstack/tester +++ b/openstack/tester @@ -167,14 +167,15 @@ class Deployment(object): @staticmethod def _ssh_host_key_exists(hostname): """Check if an ssh host key exists in known_hosts""" - if not os.path.exists('/root/.ssh/known_hosts'): + filename = os.path.expanduser('~/.ssh/known_hosts') + if not os.path.exists(filename): return False - with open('/root/.ssh/known_hosts', 'r') as known_hosts: + with open(filename, 'r') as known_hosts: return any(line.startswith(hostname) for line in known_hosts) def _update_known_hosts(self): if not self._ssh_host_key_exists(self.host_machine.address): - filename = '/root/.ssh/known_hosts'; + filename = os.path.expanduser('~/.ssh/known_hosts') print("No known_hosts: ensuring path"); if not os.path.exists(os.path.dirname(filename)): os.makedirs(os.path.dirname(filename)) |