mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-25 22:30:22 -07:00
Fix paramiko for when no private key is specified
This commit is contained in:
parent
ea45423f92
commit
35b58955d6
1 changed files with 5 additions and 1 deletions
|
@ -81,8 +81,12 @@ class Connection(object):
|
||||||
if self.runner.remote_pass is not None:
|
if self.runner.remote_pass is not None:
|
||||||
allow_agent = False
|
allow_agent = False
|
||||||
try:
|
try:
|
||||||
|
if self.runner.private_key_file:
|
||||||
|
key_filename = os.path.expanduser(self.runner.private_key_file)
|
||||||
|
else:
|
||||||
|
key_filename = None
|
||||||
ssh.connect(self.host, username=user, allow_agent=allow_agent, look_for_keys=True,
|
ssh.connect(self.host, username=user, allow_agent=allow_agent, look_for_keys=True,
|
||||||
key_filename=os.path.expanduser(self.runner.private_key_file), password=self.runner.remote_pass,
|
key_filename=key_filename, password=self.runner.remote_pass,
|
||||||
timeout=self.runner.timeout, port=self.port)
|
timeout=self.runner.timeout, port=self.port)
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
msg = str(e)
|
msg = str(e)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue