|
28 | 28 | See :mod:`pssh.ParallelSSHClient` and :mod:`pssh.SSHClient` for class documentation. |
29 | 29 | """ |
30 | 30 |
|
| 31 | +from gevent import monkey |
| 32 | +monkey.patch_all() |
| 33 | +import gevent.pool |
31 | 34 | import warnings |
32 | 35 | from socket import gaierror as sock_gaierror, error as sock_error |
33 | 36 | import logging |
34 | 37 | import paramiko |
35 | 38 | import os |
36 | | -import gevent.pool |
37 | | -from gevent import monkey |
38 | | -monkey.patch_all() |
39 | 39 |
|
40 | 40 | host_logger = logging.getLogger('host_logger') |
41 | 41 | handler = logging.StreamHandler() |
@@ -228,7 +228,7 @@ def exec_command(self, command, sudo=False, user=None, **kwargs): |
228 | 228 | command = 'bash -c "%s"' % command.replace('"', '\\"') |
229 | 229 | logger.debug("Running command %s on %s", command, self.host) |
230 | 230 | channel.exec_command(command, **kwargs) |
231 | | - logger.debug("Command finished executing") |
| 231 | + logger.debug("Command started") |
232 | 232 | while not (channel.recv_ready() or channel.closed): |
233 | 233 | gevent.sleep(.2) |
234 | 234 | return channel, self.host, stdout, stderr |
@@ -357,7 +357,7 @@ def __init__(self, hosts, |
357 | 357 | 'cmd' : <greenlet>, |
358 | 358 | }} |
359 | 359 | >>> # Print output as it comes in. |
360 | | - >>> for host in output: print output[host]['stdout'] |
| 360 | + >>> for host in output: for line in output[host]['stdout']: print line |
361 | 361 | [myhost1] ls: cannot access /tmp/aasdfasdf: No such file or directory |
362 | 362 | [myhost2] ls: cannot access /tmp/aasdfasdf: No such file or directory |
363 | 363 | >>> # Retrieve exit code after commands have finished |
|
0 commit comments