Skip to content

Commit

Permalink
Updated docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Pan committed Mar 8, 2018
1 parent 56db95f commit ad6a9b4
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions doc/advanced.rst
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,6 @@ In some cases, such as when the remote command never terminates unless interrupt
Without a PTY, the ``join`` will complete but the remote process will be left running as per SSH protocol specifications.

Output reading and Timeouts
______________________________

Furthermore, once reading output has timed out, it is necessary to restart the output generators as by Python design they only iterate once. This can be done as follows:

.. code-block:: python
Expand Down Expand Up @@ -283,18 +280,18 @@ Command can also have multiple arguments to be substituted.
.. code-block:: python
output = client.run_command('%s %s',
host_args=(('host1_cmd1', 'host1_cmd2'),
('host2_cmd1', 'host2_cmd2'),
('host3_cmd1', 'host3_cmd2'),))
host_args = (('host1_cmd1', 'host1_cmd2'),
('host2_cmd1', 'host2_cmd2'),
('host3_cmd1', 'host3_cmd2'),))
A list of dictionaries can also be used as ``host_args`` for named argument substitution.

In the following example, first host in host list will use cmd ``host-index-0``, second host ``host-index-1`` and so on.

.. code-block:: python
host_args=[{'cmd': 'host-index-%s' % (i,))
for i in range(len(client.hosts))]
host_args = [{'cmd': 'host-index-%s' % (i,)}
for i in range(len(client.hosts))]
output = client.run_command('%(cmd)s', host_args=host_args)
Expand Down

0 comments on commit ad6a9b4

Please sign in to comment.