mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-25 20:01:25 -07:00
- Fix authentication failure with paramiko when using password mode (#33303)
- break out of loop when paramiko stream is closed
This commit is contained in:
parent
0e0470bc49
commit
e65ef09aa9
1 changed files with 5 additions and 1 deletions
|
@ -162,7 +162,7 @@ class Connection(ConnectionBase):
|
||||||
return
|
return
|
||||||
|
|
||||||
p = connection_loader.get('paramiko', self._play_context, '/dev/null')
|
p = connection_loader.get('paramiko', self._play_context, '/dev/null')
|
||||||
p.set_options(direct={'look_for_keys': bool(self._play_context.password and not self._play_context.private_key_file)})
|
p.set_options(direct={'look_for_keys': not bool(self._play_context.password and not self._play_context.private_key_file)})
|
||||||
p.force_persistence = self.force_persistence
|
p.force_persistence = self.force_persistence
|
||||||
ssh = p._connect()
|
ssh = p._connect()
|
||||||
|
|
||||||
|
@ -261,6 +261,10 @@ class Connection(ConnectionBase):
|
||||||
while True:
|
while True:
|
||||||
data = self._ssh_shell.recv(256)
|
data = self._ssh_shell.recv(256)
|
||||||
|
|
||||||
|
# when a channel stream is closed, received data will be empty
|
||||||
|
if not data:
|
||||||
|
break
|
||||||
|
|
||||||
recv.write(data)
|
recv.write(data)
|
||||||
offset = recv.tell() - 256 if recv.tell() > 256 else 0
|
offset = recv.tell() - 256 if recv.tell() > 256 else 0
|
||||||
recv.seek(offset)
|
recv.seek(offset)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue