mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
wrapped new system ssh key lookup in case file does not exist
This commit is contained in:
parent
491b5fea6a
commit
b9710b4a34
1 changed files with 5 additions and 1 deletions
|
@ -152,7 +152,11 @@ class Connection(ConnectionBase):
|
||||||
self.keyfile = os.path.expanduser("~/.ssh/known_hosts")
|
self.keyfile = os.path.expanduser("~/.ssh/known_hosts")
|
||||||
|
|
||||||
if C.HOST_KEY_CHECKING:
|
if C.HOST_KEY_CHECKING:
|
||||||
ssh.load_system_host_keys("/etc/ssh/ssh_known_hosts")
|
try:
|
||||||
|
#TODO: check if we need to look at several possible locations, possible for loop
|
||||||
|
ssh.load_system_host_keys("/etc/ssh/ssh_known_hosts")
|
||||||
|
except IOError:
|
||||||
|
pass # file was not found, but not required to function
|
||||||
ssh.load_system_host_keys()
|
ssh.load_system_host_keys()
|
||||||
|
|
||||||
ssh.set_missing_host_key_policy(MyAddPolicy(self._new_stdin))
|
ssh.set_missing_host_key_policy(MyAddPolicy(self._new_stdin))
|
||||||
|
|
Loading…
Reference in a new issue