You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
60
60
61
61
::
62
62
@@ -69,6 +69,23 @@ Joining on the connection pool can be used to block and wait for all parallel co
69
69
70
70
client.pool.join()
71
71
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
+
72
89
73
90
**************************
74
91
Frequently asked questions
@@ -100,21 +117,21 @@ Frequently asked questions
100
117
:A:
101
118
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.
102
119
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.
104
121
105
122
:Q:
106
123
Can ParallelSSH forward my SSH agent?
107
124
108
125
: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.
110
127
111
128
:Q:
112
129
Is tunneling/proxying supported?
113
130
114
131
:A:
115
132
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.
116
133
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.
Is there a way to programmatically provide an SSH key?
125
142
126
143
: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::
128
145
129
146
from pssh import ParallelSSHClient, utils
130
147
client_key = utils.load_private_key('user.key')
@@ -141,7 +158,7 @@ Frequently asked questions
141
158
SFTP/SCP
142
159
********
143
160
144
-
SFTP is supported (SCP version 2) natively, no `scp` command required.
161
+
SFTP is supported (SCP version 2) natively, no ``scp`` command required.
145
162
146
163
For example to copy a local file to remote hosts in parallel::
0 commit comments