Skip to content

Commit a410fc7

Browse files
author
Dan
committed
Updated docstring. Made socket exceptions more specific. Updated docs
1 parent 81f4672 commit a410fc7

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

pssh.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
# License along with this library; if not, write to the Free Software
1818
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
1919

20-
"""Small wrapper library over paramiko that allows for parallel execution of SSH commands on remote hosts and executing simple single host commands over SSH.
20+
"""Asynchronous parallel SSH library
2121
2222
parallel-ssh uses asychronous network requests - there is *no* multi-threading or multi-processing used.
2323
@@ -28,13 +28,13 @@
2828
See :mod:`pssh.ParallelSSHClient` and :mod:`pssh.SSHClient` for class documentation.
2929
"""
3030

31-
import gevent.pool
32-
from gevent import socket
33-
from gevent import monkey
34-
monkey.patch_all()
31+
from socket import gaierror as sock_gaierror, error as sock_error
3532
import logging
3633
import paramiko
3734
import os
35+
import gevent.pool
36+
from gevent import monkey
37+
monkey.patch_all()
3838

3939
host_logger = logging.getLogger('host_logging')
4040
handler = logging.StreamHandler()
@@ -158,7 +158,7 @@ def _connect(self, retries=1):
158158
password=self.password, port=self.port,
159159
pkey=self.pkey,
160160
sock=self.proxy_command, timeout=self.timeout)
161-
except socket.gaierror, e:
161+
except sock_gaierror, e:
162162
logger.error("Could not resolve host '%s' - retry %s/%s",
163163
self.host, retries, self.num_retries)
164164
while retries < self.num_retries:
@@ -167,7 +167,7 @@ def _connect(self, retries=1):
167167
raise UnknownHostException("%s - %s - retry %s/%s",
168168
str(e.args[1]),
169169
self.host, retries, self.num_retries)
170-
except socket.error, e:
170+
except sock_error, e:
171171
logger.error("Error connecting to host '%s:%s' - retry %s/%s",
172172
self.host, self.port, retries, self.num_retries)
173173
while retries < self.num_retries:

tests/test_pssh_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ def test_pssh_client_timeout(self):
124124
gevent.sleep(0.5)
125125
cmd.get()
126126
if not server.exception:
127-
raise Exception("Expected EOFError from socket timeout, got none")
127+
raise Exception("Expected gevent.Timeout from socket timeout, got none")
128128
raise server.exception
129129
except gevent.Timeout:
130130
pass

0 commit comments

Comments
 (0)