Skip to content

Commit c0e31d5

Browse files
author
Dan
committed
Added set timeout on SSH channel if timeout is given. Removed host_logger lines in exec_command, now done in the stdout/stdin generators
1 parent 43f3d7a commit c0e31d5

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

pssh.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,8 @@ def exec_command(self, command, sudo=False, user=None, **kwargs):
212212
if self.forward_ssh_agent:
213213
agent_handler = paramiko.agent.AgentRequestHandler(channel)
214214
channel.get_pty()
215+
if self.timeout:
216+
channel.settimeout(self.timeout)
215217
_stdout, _stderr = channel.makefile('rb'), \
216218
channel.makefile_stderr('rb')
217219
stdout, stderr = self._read_output_buffer(_stdout,), \
@@ -590,9 +592,9 @@ def get_stdout(self, greenlet, return_buffers=False):
590592
# Channel must be closed or reading stdout/stderr will block forever
591593
if not return_buffers and channel.closed:
592594
for line in stdout:
593-
host_logger.info("[%s]\t%s", host, line,)
595+
pass
594596
for line in stderr:
595-
host_logger.info("[%s] [err] %s", host, line,)
597+
pass
596598
return {host: {'exit_code': channel.recv_exit_status(),}}
597599
gevent.sleep(.2)
598600
return {host: {'exit_code': channel.recv_exit_status() if channel.exit_status_ready() else None,

0 commit comments

Comments
 (0)