Avoids authentication failed exception if user has private rsa keys under .ssh

This commit is contained in:
ogenstad 2016-02-23 11:17:24 +01:00
parent 078ebb0dec
commit 3f95f163ff

View file

@ -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