Skip to content

Commit a23030c

Browse files
author
Dan
committed
Updated readme
1 parent 2134b70 commit a23030c

File tree

1 file changed

+24
-7
lines changed

1 file changed

+24
-7
lines changed

README.rst

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Usage Example
3232

3333
See documentation on `read the docs`_ for more complete examples.
3434

35-
Run `ls` on two remote hosts in parallel with `sudo`.
35+
Run ``ls`` on two remote hosts in parallel with ``sudo``.
3636

3737
::
3838

@@ -56,7 +56,7 @@ Stdout and stderr buffers are available in output. Iterating on them can be used
5656
Host myhost2 - output: drwxr-xr-x 6 xxx xxx 4.0K Jan 1 00:00 xxx
5757
Host myhost2 - output: <..>
5858

59-
Exit codes become available once stdout/stderr is iterated on or `client.join(output)` is called.
59+
Exit codes become available once stdout/stderr is iterated on or ``client.join(output)`` is called.
6060

6161
::
6262

@@ -69,6 +69,23 @@ Joining on the connection pool can be used to block and wait for all parallel co
6969

7070
client.pool.join()
7171

72+
Similarly, if only exit codes are needed but not output ::
73+
74+
output = client.run_command('exit 0')
75+
# Block and gather exit codes. Output variable is updated in-place
76+
client.join(output)
77+
print output[client.hosts[0]]['exit_code']
78+
0
79+
80+
There is a also host logger that can be enabled to log output from remote hosts. The helper function ``pssh.utils.enable_host_logger`` will enable host logging to stdout, for example ::
81+
82+
import pssh.utils
83+
pssh.utils.enable_host_logger()
84+
output = client.run_command('uname')
85+
client.join(output)
86+
87+
[localhost] Linux
88+
7289

7390
**************************
7491
Frequently asked questions
@@ -100,21 +117,21 @@ Frequently asked questions
100117
:A:
101118
All available keys in a system configured SSH agent in addition to SSH keys in the user's home directory, `~/.ssh/id_dsa`, `~/.ssh/id_rsa` et al are automatically used by ParallelSSH.
102119

103-
Use of SSH agent can be disabled by creating a client as `ParallelSSHClient(allow_agent=False)`. `See documentation <http://parallel-ssh.readthedocs.org/en/latest/>`_ for more information.
120+
Use of SSH agent can be disabled by creating a client as ``ParallelSSHClient(allow_agent=False)``. `See documentation <http://parallel-ssh.readthedocs.org/en/latest/>`_ for more information.
104121

105122
:Q:
106123
Can ParallelSSH forward my SSH agent?
107124

108125
:A:
109-
SSH agent forwarding, what `ssh -A` does on the command line, is supported and enabled by default. Creating an object as `ParallelSSHClient(forward_ssh_agent=False)` will disable that behaviour.
126+
SSH agent forwarding, what ``ssh -A`` does on the command line, is supported and enabled by default. Creating an object as ``ParallelSSHClient(forward_ssh_agent=False)`` will disable that behaviour.
110127

111128
:Q:
112129
Is tunneling/proxying supported?
113130

114131
:A:
115132
Yes, `ParallelSSH` natively supports tunelling through an intermediate SSH server. Connecting to a remote host is accomplished via an SSH tunnel using the SSH's protocol direct TCP tunneling feature, using local port forwarding. This is done natively in python and tunnel connections are asynchronous like all other connections in the `ParallelSSH` library. For example, client -> proxy SSH server -> remote SSH destination.
116133

117-
Use the `proxy_host` and `proxy_port` parameters to configure your proxy.
134+
Use the ``proxy_host`` and ``proxy_port`` parameters to configure your proxy.
118135

119136
>>> client = ParallelSSHClient(hosts, proxy_host='my_ssh_proxy_host')
120137

@@ -124,7 +141,7 @@ Frequently asked questions
124141
Is there a way to programmatically provide an SSH key?
125142

126143
:A:
127-
Yes, use the `pkey` parameter of the `ParallelSSHClient class <http://parallel-ssh.readthedocs.org/en/latest/#pssh.ParallelSSHClient>`_. There is a `load_private_key` helper function in `pssh.utils` that can be used to load any key type. For example::
144+
Yes, use the ``pkey`` parameter of the `ParallelSSHClient class <http://parallel-ssh.readthedocs.org/en/latest/#pssh.ParallelSSHClient>`_. There is a ``load_private_key`` helper function in ``pssh.utils`` that can be used to load any supported key type. For example::
128145

129146
from pssh import ParallelSSHClient, utils
130147
client_key = utils.load_private_key('user.key')
@@ -141,7 +158,7 @@ Frequently asked questions
141158
SFTP/SCP
142159
********
143160

144-
SFTP is supported (SCP version 2) natively, no `scp` command required.
161+
SFTP is supported (SCP version 2) natively, no ``scp`` command required.
145162

146163
For example to copy a local file to remote hosts in parallel::
147164

0 commit comments

Comments
 (0)