Skip to content

Commit 0db3443

Browse files
author
Dan
committed
Updated doc strings post refactor. Updated documentation for better readability and table of contents
1 parent 1ca6a20 commit 0db3443

File tree

7 files changed

+44
-25
lines changed

7 files changed

+44
-25
lines changed

doc/conf.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,16 +57,16 @@
5757

5858
# General information about the project.
5959
project = u'Parallel-SSH'
60-
copyright = u'2015, P Kittenis'
60+
copyright = u'2015-, P Kittenis'
6161

6262
# The version info for the project you're documenting, acts as replacement for
6363
# |version| and |release|, also used in various other places throughout the
6464
# built documents.
6565
#
6666
# The short X.Y version.
67-
version = '0.70'
67+
version = '0.80'
6868
# The full version, including alpha/beta/rc tags.
69-
release = '0.70.2'
69+
release = '0.80.0'
7070

7171
# The language for content autogenerated by Sphinx. Refer to documentation
7272
# for a list of supported languages.

doc/exceptions.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Exceptions
2+
==========
3+
4+
.. automodule:: pssh.exceptions
5+
:member-order: groupwise

doc/index.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,22 @@ Parallel-SSH's documentation
77
============================
88

99
.. toctree::
10-
:maxdepth: 4
1110
:hidden:
12-
:titlesonly:
1311

1412
self
1513

16-
Welcome to ParallelSSH's API documentation.
14+
.. toctree::
1715

18-
New users should start with :mod:`pssh.ParallelSSHClient.run_command`.
16+
pssh_client
17+
ssh_client
18+
exceptions
19+
20+
Welcome to ParallelSSH's API documentation.
1921

20-
.. automodule:: pssh
21-
:member-order: groupwise
22+
New users should start with :mod:`pssh.pssh_client.ParallelSSHClient.run_command`.
2223

2324

2425
Indices and tables
2526
==================
2627

2728
* :ref:`genindex`
28-
* :ref:`search`

doc/pssh_client.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
ParallelSSHClient API Documentation
2+
===================================
3+
4+
.. automodule:: pssh.pssh_client
5+
:member-order: groupwise

doc/ssh_client.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
SSHClient API Documentation
2+
===========================
3+
4+
.. automodule:: pssh.ssh_client
5+
:member-order: groupwise

pssh/pssh_client.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535

3636

3737
class ParallelSSHClient(object):
38-
"""Uses :mod:`pssh.SSHClient`, performs tasks over SSH on multiple hosts in \
38+
"""Uses :mod:`pssh.ssh_client.SSHClient`, performs tasks over SSH on multiple hosts in \
3939
parallel.
4040
4141
Connections to hosts are established in parallel when ``run_command`` is called,
@@ -169,13 +169,15 @@ def run_command(self, *args, **kwargs):
169169
:type sudo: bool
170170
:param kwargs: Keyword arguments for command
171171
:type kwargs: dict
172-
173-
:rtype: Dictionary with host as key as per :mod:`ParallelSSH.get_output`
172+
:param stop_on_errors: (Optional) Raise exception on errors running command. \
173+
Defaults to True.
174+
:type stop_on_errors: bool
175+
:rtype: Dictionary with host as key as per :mod:`pssh.pssh_client.ParallelSSH.get_output`
174176
175-
:raises: :mod:`pssh.AuthenticationException` on authentication error
176-
:raises: :mod:`pssh.UnknownHostException` on DNS resolution error
177-
:raises: :mod:`pssh.ConnectionErrorException` on error connecting
178-
:raises: :mod:`pssh.SSHException` on other undefined SSH errors
177+
:raises: :mod:`pssh.exceptions.AuthenticationException` on authentication error
178+
:raises: :mod:`pssh.exceptions.UnknownHostException` on DNS resolution error
179+
:raises: :mod:`pssh.exceptions.ConnectionErrorException` on error connecting
180+
:raises: :mod:`pssh.exceptions.SSHException` on other undefined SSH errors
179181
180182
**Example Usage**
181183
@@ -234,7 +236,7 @@ def run_command(self, *args, **kwargs):
234236
def exec_command(self, *args, **kwargs):
235237
"""Run command on all hosts in parallel, honoring `self.pool_size`
236238
237-
**Deprecated by** :mod:`pssh.ParallelSSHClient.run_command`
239+
**Deprecated by** :mod:`pssh.pssh_client.ParallelSSHClient.run_command`
238240
239241
:param args: Position arguments for command
240242
:type args: tuple
@@ -265,11 +267,11 @@ def get_output(self, cmd, output):
265267
266268
:param cmd: Command to get output from
267269
:type cmd: :mod:`gevent.Greenlet`
268-
:param output: Dictionary containing output to be updated with output
270+
:param output: Dictionary containing output to be updated with output \
269271
from cmd
270272
:type output: dict
271273
:rtype: None
272-
274+
273275
`output` parameter is modified in-place and has the following structure
274276
275277
::

pssh/ssh_client.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,10 @@ def _connect_tunnel(self):
122122
"""Connects to SSH server via an intermediate SSH tunnel server.
123123
client (me) -> tunnel (ssh server to proxy through) -> \
124124
destination (ssh server to run command)
125+
125126
:rtype: `:mod:paramiko.SSHClient` Client to remote SSH destination
126-
via intermediate SSH tunnel server."""
127+
via intermediate SSH tunnel server.
128+
"""
127129
self.proxy_client = paramiko.SSHClient()
128130
self.proxy_client.set_missing_host_key_policy(paramiko.MissingHostKeyPolicy())
129131
self._connect(self.proxy_client, self.proxy_host, self.proxy_port)
@@ -137,10 +139,10 @@ def _connect_tunnel(self):
137139
def _connect(self, client, host, port, sock=None, retries=1):
138140
"""Connect to host
139141
140-
:raises: :mod:`pssh.AuthenticationException` on authentication error
141-
:raises: :mod:`pssh.UnknownHostException` on DNS resolution error
142-
:raises: :mod:`pssh.ConnectionErrorException` on error connecting
143-
:raises: :mod:`pssh.SSHException` on other undefined SSH errors
142+
:raises: :mod:`pssh.exceptions.AuthenticationException` on authentication error
143+
:raises: :mod:`pssh.exceptions.UnknownHostException` on DNS resolution error
144+
:raises: :mod:`pssh.exceptions.ConnectionErrorException` on error connecting
145+
:raises: :mod:`pssh.exceptions.SSHException` on other undefined SSH errors
144146
"""
145147
try:
146148
client.connect(host, username=self.user,

0 commit comments

Comments
 (0)