Skip to content

Commit c56807e

Browse files
author
Dan
committed
Refactored module into packages for readability and better structuring of code
1 parent cd59fab commit c56807e

File tree

6 files changed

+402
-296
lines changed

6 files changed

+402
-296
lines changed

pssh/__init__.py

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/usr/bin/env python
2+
3+
# This file is part of parallel-ssh.
4+
5+
# Copyright (C) 2015 Panos Kittenis
6+
7+
# This library is free software; you can redistribute it and/or
8+
# modify it under the terms of the GNU Lesser General Public
9+
# License as published by the Free Software Foundation, version 2.1.
10+
11+
# This library is distributed in the hope that it will be useful,
12+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14+
# Lesser General Public License for more details.
15+
16+
# You should have received a copy of the GNU Lesser General Public
17+
# License along with this library; if not, write to the Free Software
18+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19+
20+
"""Asynchronous parallel SSH library
21+
22+
parallel-ssh uses asychronous network requests - there is *no* multi-threading nor multi-processing used.
23+
24+
This is a *requirement* for commands on many (hundreds/thousands/hundreds of thousands) of hosts which would grind a system to a halt simply by having so many processes/threads all wanting to execute if done with multi-threading/processing.
25+
26+
The `libev event loop library <http://software.schmorp.de/pkg/libev.html>`_ is utilised on nix systems. Windows is not supported.
27+
28+
See :mod:`pssh.ParallelSSHClient` and :mod:`pssh.SSHClient` for class documentation.
29+
"""
30+
import logging
31+
from .utils import enable_host_logger
32+
from .pssh_client import ParallelSSHClient
33+
from .ssh_client import SSHClient
34+
from .exceptions import UnknownHostException, \
35+
AuthenticationException, ConnectionErrorException, SSHException
36+
37+
38+
host_logger = logging.getLogger('pssh.host_logger')
39+
logger = logging.getLogger('pssh')

pssh/constants.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# This file is part of parallel-ssh.
2+
3+
# Copyright (C) 2015 Panos Kittenis
4+
5+
# This library is free software; you can redistribute it and/or
6+
# modify it under the terms of the GNU Lesser General Public
7+
# License as published by the Free Software Foundation, version 2.1.
8+
9+
# This library is distributed in the hope that it will be useful,
10+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12+
# Lesser General Public License for more details.
13+
14+
# You should have received a copy of the GNU Lesser General Public
15+
# License along with this library; if not, write to the Free Software
16+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17+
18+
19+
DEFAULT_RETRIES = 3

pssh/exceptions.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# This file is part of parallel-ssh.
2+
3+
# Copyright (C) 2015 Panos Kittenis
4+
5+
# This library is free software; you can redistribute it and/or
6+
# modify it under the terms of the GNU Lesser General Public
7+
# License as published by the Free Software Foundation, version 2.1.
8+
9+
# This library is distributed in the hope that it will be useful,
10+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12+
# Lesser General Public License for more details.
13+
14+
# You should have received a copy of the GNU Lesser General Public
15+
# License along with this library; if not, write to the Free Software
16+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17+
18+
19+
"""Exceptions raised by parallel-ssh classes"""
20+
21+
class UnknownHostException(Exception):
22+
"""Raised when a host is unknown (dns failure)"""
23+
pass
24+
25+
26+
class ConnectionErrorException(Exception):
27+
"""Raised on error connecting (connection refused/timed out)"""
28+
pass
29+
30+
31+
class AuthenticationException(Exception):
32+
"""Raised on authentication error (user/password/ssh key error)"""
33+
pass
34+
35+
36+
class SSHException(Exception):
37+
"""Raised on SSHException error - error authenticating with SSH server"""
38+
pass

0 commit comments

Comments
 (0)