mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-10-04 23:44:00 -07:00
Make it possible to tell paramiko to not record new host keys, which can be slow with a large number of hosts.
-c ssh is preferred in most cases if you have ControlPersist available, otherwise if you are comfortable you can turn off recording while leaving host key checking on, etc.
This commit is contained in:
parent
14818af446
commit
cf6e1f8db9
3 changed files with 13 additions and 3 deletions
|
@ -303,9 +303,14 @@ class Connection(object):
|
|||
if self.sftp is not None:
|
||||
self.sftp.close()
|
||||
|
||||
if self._any_keys_added():
|
||||
if C.PARAMIKO_RECORD_HOST_KEYS and self._any_keys_added():
|
||||
|
||||
# add any new SSH host keys -- warning -- this could be slow
|
||||
lockfile = self.keyfile.replace("known_hosts",".known_hosts.lock")
|
||||
dirname = os.path.dirname(self.keyfile)
|
||||
if not os.path.exists(dirname):
|
||||
os.makedirs(dirname)
|
||||
|
||||
KEY_LOCK = open(lockfile, 'w')
|
||||
fcntl.lockf(KEY_LOCK, fcntl.LOCK_EX)
|
||||
try:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue