Skip to content

Commit 61688d9

Browse files
Danpkittenis
authored andcommitted
Updated documentation to use readthedocs
1 parent 9b72677 commit 61688d9

File tree

3 files changed

+39
-6
lines changed

3 files changed

+39
-6
lines changed

README.rst

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,13 @@ This is a *requirement* for commands on many (hundreds/thousands/hundreds of tho
1717
.. image:: https://pypip.in/download/parallel-ssh/badge.png
1818
:target: https://pypip.in/download/parallel-ssh
1919
:alt: downloads
20+
.. image:: https://readthedocs.org/projects/parallel-ssh/badge/?version=latest
21+
:target: http://parallel-ssh.readthedocs.org/en/latest/
22+
:alt: Latest documentation
2023

21-
Module documentation can be found at the repository's `github pages`_.
24+
Module documentation can be found at `read the docs`_.
2225

23-
.. _`github pages`: http://pkittenis.github.io/parallel-ssh
26+
.. _`read the docs`: http://parallel-ssh.readthedocs.org/en/latest/
2427

2528
************
2629
Installation
@@ -34,7 +37,7 @@ Installation
3437
Usage Examples
3538
**************
3639

37-
See documentation on `github pages`_ for more complete examples
40+
See documentation on `read the docs`_ for more complete examples
3841

3942
Run `ls` on two remote hosts in parallel.
4043

doc/index.rst

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Welcome to Parallel-SSH's documentation!
88

99
.. toctree::
1010
:maxdepth: 4
11+
:hidden:
1112

1213
.. automodule:: pssh
1314
:members: ParallelSSHClient, SSHClient, UnknownHostException, ConnectionErrorException, AuthenticationException, ProxyCommandException
@@ -17,7 +18,4 @@ Welcome to Parallel-SSH's documentation!
1718
Indices and tables
1819
==================
1920

20-
* :ref:`genindex`
2121
* :ref:`modindex`
22-
* :ref:`search`
23-

pssh_local.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
from pssh import SSHClient, ParallelSSHClient
2+
import logging
3+
4+
logger = logging.getLogger(__name__)
5+
6+
def _setup_logger(_logger):
7+
"""Setup default logger"""
8+
_handler = logging.StreamHandler()
9+
log_format = logging.Formatter('%(name)s - %(asctime)s - %(levelname)s - %(message)s')
10+
_handler.setFormatter(log_format)
11+
_logger.addHandler(_handler)
12+
_logger.setLevel(logging.DEBUG)
13+
14+
def test():
15+
client = SSHClient('localhost')
16+
channel, host, stdout, stderr = client.exec_command('ls -ltrh')
17+
for line in stdout:
18+
print line.strip()
19+
client.copy_file('../test', 'test_dir/test')
20+
21+
def test_parallel():
22+
client = ParallelSSHClient(['localhost'])
23+
cmds = client.exec_command('ls -ltrh')
24+
output = [client.get_stdout(cmd, return_buffers=True) for cmd in cmds]
25+
print output
26+
cmds = client.copy_file('../test', 'test_dir/test')
27+
client.pool.join()
28+
29+
if __name__ == "__main__":
30+
_setup_logger(logger)
31+
test()
32+
test_parallel()

0 commit comments

Comments
 (0)