mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Avoids authentication failed exception if user has private rsa keys under .ssh
This commit is contained in:
parent
078ebb0dec
commit
3f95f163ff
1 changed files with 3 additions and 3 deletions
|
@ -88,7 +88,8 @@ class Shell(object):
|
|||
self.errors.extend(CLI_ERRORS_RE)
|
||||
|
||||
def open(self, host, port=22, username=None, password=None,
|
||||
timeout=10, key_filename=None, pkey=None, look_for_keys=None):
|
||||
timeout=10, key_filename=None, pkey=None, look_for_keys=None,
|
||||
allow_agent=False):
|
||||
|
||||
self.ssh = paramiko.SSHClient()
|
||||
self.ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
||||
|
@ -100,7 +101,7 @@ class Shell(object):
|
|||
|
||||
self.ssh.connect(host, port=port, username=username, password=password,
|
||||
timeout=timeout, look_for_keys=look_for_keys, pkey=pkey,
|
||||
key_filename=key_filename)
|
||||
key_filename=key_filename, allow_agent=allow_agent)
|
||||
|
||||
self.shell = self.ssh.invoke_shell()
|
||||
self.shell.settimeout(10)
|
||||
|
@ -199,4 +200,3 @@ def get_cli_connection(module):
|
|||
module.fail_json(msg='socket timed out')
|
||||
|
||||
return cli
|
||||
|
||||
|
|
Loading…
Reference in a new issue