sshreader 5.0.4__tar.gz → 6.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {sshreader-5.0.4/sshreader.egg-info → sshreader-6.0.0}/PKG-INFO +40 -38
- {sshreader-5.0.4 → sshreader-6.0.0}/README.md +26 -25
- sshreader-6.0.0/pyproject.toml +53 -0
- {sshreader-5.0.4 → sshreader-6.0.0}/sshreader/__init__.py +3 -3
- sshreader-5.0.4/sshreader/types.py → sshreader-6.0.0/sshreader/customtypes.py +2 -2
- {sshreader-5.0.4 → sshreader-6.0.0}/sshreader/scripts/__init__.py +1 -1
- {sshreader-5.0.4 → sshreader-6.0.0}/sshreader/scripts/pydsh.py +23 -7
- {sshreader-5.0.4 → sshreader-6.0.0}/sshreader/ssh.py +2 -2
- {sshreader-5.0.4 → sshreader-6.0.0}/sshreader/utils.py +3 -3
- sshreader-5.0.4/PKG-INFO +0 -111
- sshreader-5.0.4/setup.cfg +0 -4
- sshreader-5.0.4/setup.py +0 -45
- sshreader-5.0.4/sshreader.egg-info/SOURCES.txt +0 -16
- sshreader-5.0.4/sshreader.egg-info/dependency_links.txt +0 -1
- sshreader-5.0.4/sshreader.egg-info/entry_points.txt +0 -2
- sshreader-5.0.4/sshreader.egg-info/requires.txt +0 -5
- sshreader-5.0.4/sshreader.egg-info/top_level.txt +0 -2
- {sshreader-5.0.4 → sshreader-6.0.0}/LICENSE +0 -0
- {sshreader-5.0.4 → sshreader-6.0.0}/LICENSE.lesser +0 -0
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: sshreader
|
|
3
|
-
Version:
|
|
3
|
+
Version: 6.0.0
|
|
4
4
|
Summary: Multi-threading/processing wrapper for Paramiko
|
|
5
5
|
Home-page: http://sshreader.readthedocs.io/
|
|
6
|
+
License: LGPL-3.0-or-later
|
|
6
7
|
Author: Jesse Almanrode
|
|
7
8
|
Author-email: jesse@almanrode.com
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
Project-URL: Tracker, https://bitbucket.org/isaiah1112/sshreader/issues
|
|
11
|
-
Platform: Linux
|
|
12
|
-
Platform: Darwin
|
|
13
|
-
Classifier: Programming Language :: Python
|
|
9
|
+
Requires-Python: >3.8,<3.13
|
|
10
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
14
11
|
Classifier: Intended Audience :: Developers
|
|
15
12
|
Classifier: License :: OSI Approved :: GNU Lesser General Public License v3 or later (LGPLv3+)
|
|
16
|
-
Classifier: Development Status :: 5 - Production/Stable
|
|
17
13
|
Classifier: Programming Language :: Python
|
|
18
|
-
Classifier: Programming Language :: Python :: 3
|
|
19
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
20
15
|
Classifier: Programming Language :: Python :: 3.9
|
|
21
16
|
Classifier: Programming Language :: Python :: 3.10
|
|
22
17
|
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
23
20
|
Classifier: Topic :: Software Development :: Libraries
|
|
24
21
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
25
|
-
Requires-
|
|
22
|
+
Requires-Dist: click (>=8,<9)
|
|
23
|
+
Requires-Dist: colorama (>=0.4,<0.5)
|
|
24
|
+
Requires-Dist: paramiko (>=3,<4)
|
|
25
|
+
Requires-Dist: progressbar2 (>=4,<5)
|
|
26
|
+
Requires-Dist: python-hostlist (>=1,<2)
|
|
27
|
+
Project-URL: Repository, https://bitbucket.org/isaiah1112/sshreader/
|
|
26
28
|
Description-Content-Type: text/markdown
|
|
27
|
-
License-File: LICENSE
|
|
28
|
-
License-File: LICENSE.lesser
|
|
29
29
|
|
|
30
30
|
# [sshreader][]
|
|
31
31
|
|
|
@@ -37,11 +37,11 @@ across multiple servers parallel. It utilizes the [Paramiko](http://www.paramik
|
|
|
37
37
|
In order to maintain the widest range of compatibility, [SSHreader][] is currently tested using the following versions of
|
|
38
38
|
Python:
|
|
39
39
|
|
|
40
|
-
* Python3.7
|
|
41
40
|
* Python3.8
|
|
42
41
|
* Python3.9
|
|
43
42
|
* Python3.10
|
|
44
43
|
* Python3.11
|
|
44
|
+
* Python3.12
|
|
45
45
|
|
|
46
46
|
## License
|
|
47
47
|
|
|
@@ -56,32 +56,12 @@ The most straightforward way to get the [SSHreader][] module working for you is:
|
|
|
56
56
|
pip install sshreader
|
|
57
57
|
```
|
|
58
58
|
|
|
59
|
-
This
|
|
60
|
-
|
|
61
|
-
### Development Installation
|
|
62
|
-
|
|
63
|
-
If you are wanting to work on development of [SSHreader][] perform the following:
|
|
64
|
-
|
|
65
|
-
```commandline
|
|
66
|
-
make install
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
To ensure all development requirements are met. This will allow you to build the Sphinx Documentation for [SSHreader][]
|
|
70
|
-
or run the unit/integration tests!
|
|
59
|
+
This ensures that all the requirements are met.
|
|
71
60
|
|
|
72
61
|
## Documentation
|
|
73
62
|
|
|
74
63
|
The documentation for [SSHreader][] can be found [here](https://sshreader.readthedocs.io)
|
|
75
64
|
|
|
76
|
-
### Building Docs
|
|
77
|
-
|
|
78
|
-
If you have installed the requirements for [SSHreader][] you can build its Sphinx Documentation simply by:
|
|
79
|
-
|
|
80
|
-
```commandline
|
|
81
|
-
make docs
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
Then simply open `docs/build/html/index.html` in your browser.
|
|
85
65
|
|
|
86
66
|
## Contributing
|
|
87
67
|
|
|
@@ -96,11 +76,32 @@ towards.
|
|
|
96
76
|
Code contributions are encouraged: please feel free to [fork the
|
|
97
77
|
project](https://bitbucket.org/isaiah1112/sshreader) and submit pull requests to the develop branch.
|
|
98
78
|
|
|
79
|
+
### Development Installation
|
|
80
|
+
|
|
81
|
+
If you are wanting to work on development of [SSHreader][], first ensure [Poetry](https://python-poetry.org) is installed
|
|
82
|
+
and then:
|
|
83
|
+
|
|
84
|
+
```commandline
|
|
85
|
+
poetry install --with dev
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
To ensure all development requirements are met. This will allow you to run the unit/integration tests!
|
|
89
|
+
|
|
90
|
+
### Building Docs
|
|
91
|
+
|
|
92
|
+
If you have installed [Poetry](https://python-poetry.org)] you can build its Sphinx Documentation for [SSHreader][] simply by:
|
|
93
|
+
|
|
94
|
+
```commandline
|
|
95
|
+
make docs
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Then simply open `docs/build/html/index.html` in your browser.
|
|
99
|
+
|
|
99
100
|
## Extras
|
|
100
101
|
|
|
101
|
-
Included with sshreader is a
|
|
102
|
-
|
|
103
|
-
|
|
102
|
+
Included with sshreader is a script called `pydsh`. This works very similar to[pdsh](https://computing.llnl.gov/linux/pdsh.html)
|
|
103
|
+
but uses sshreader at its core to perform ssh commands in parallel and return the results.
|
|
104
|
+
The output of `pydsh` can also be piped through the `dshbak` tool that comes with pdsh.
|
|
104
105
|
|
|
105
106
|
Pydsh uses [hostlist expressions](https://www.nsc.liu.se/~kent/python-hostlist/) to get its list of hosts
|
|
106
107
|
to process.
|
|
@@ -109,3 +110,4 @@ to process.
|
|
|
109
110
|
[GNU Lesser General Public License v3.0]: http://choosealicense.com/licenses/lgpl-3.0/ "LGPL v3"
|
|
110
111
|
|
|
111
112
|
[sshreader]: https://bitbucket.org/isaiah1112/sshreader "SSHreader Package"
|
|
113
|
+
|
|
@@ -8,11 +8,11 @@ across multiple servers parallel. It utilizes the [Paramiko](http://www.paramik
|
|
|
8
8
|
In order to maintain the widest range of compatibility, [SSHreader][] is currently tested using the following versions of
|
|
9
9
|
Python:
|
|
10
10
|
|
|
11
|
-
* Python3.7
|
|
12
11
|
* Python3.8
|
|
13
12
|
* Python3.9
|
|
14
13
|
* Python3.10
|
|
15
14
|
* Python3.11
|
|
15
|
+
* Python3.12
|
|
16
16
|
|
|
17
17
|
## License
|
|
18
18
|
|
|
@@ -27,32 +27,12 @@ The most straightforward way to get the [SSHreader][] module working for you is:
|
|
|
27
27
|
pip install sshreader
|
|
28
28
|
```
|
|
29
29
|
|
|
30
|
-
This
|
|
31
|
-
|
|
32
|
-
### Development Installation
|
|
33
|
-
|
|
34
|
-
If you are wanting to work on development of [SSHreader][] perform the following:
|
|
35
|
-
|
|
36
|
-
```commandline
|
|
37
|
-
make install
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
To ensure all development requirements are met. This will allow you to build the Sphinx Documentation for [SSHreader][]
|
|
41
|
-
or run the unit/integration tests!
|
|
30
|
+
This ensures that all the requirements are met.
|
|
42
31
|
|
|
43
32
|
## Documentation
|
|
44
33
|
|
|
45
34
|
The documentation for [SSHreader][] can be found [here](https://sshreader.readthedocs.io)
|
|
46
35
|
|
|
47
|
-
### Building Docs
|
|
48
|
-
|
|
49
|
-
If you have installed the requirements for [SSHreader][] you can build its Sphinx Documentation simply by:
|
|
50
|
-
|
|
51
|
-
```commandline
|
|
52
|
-
make docs
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
Then simply open `docs/build/html/index.html` in your browser.
|
|
56
36
|
|
|
57
37
|
## Contributing
|
|
58
38
|
|
|
@@ -67,11 +47,32 @@ towards.
|
|
|
67
47
|
Code contributions are encouraged: please feel free to [fork the
|
|
68
48
|
project](https://bitbucket.org/isaiah1112/sshreader) and submit pull requests to the develop branch.
|
|
69
49
|
|
|
50
|
+
### Development Installation
|
|
51
|
+
|
|
52
|
+
If you are wanting to work on development of [SSHreader][], first ensure [Poetry](https://python-poetry.org) is installed
|
|
53
|
+
and then:
|
|
54
|
+
|
|
55
|
+
```commandline
|
|
56
|
+
poetry install --with dev
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
To ensure all development requirements are met. This will allow you to run the unit/integration tests!
|
|
60
|
+
|
|
61
|
+
### Building Docs
|
|
62
|
+
|
|
63
|
+
If you have installed [Poetry](https://python-poetry.org)] you can build its Sphinx Documentation for [SSHreader][] simply by:
|
|
64
|
+
|
|
65
|
+
```commandline
|
|
66
|
+
make docs
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Then simply open `docs/build/html/index.html` in your browser.
|
|
70
|
+
|
|
70
71
|
## Extras
|
|
71
72
|
|
|
72
|
-
Included with sshreader is a
|
|
73
|
-
|
|
74
|
-
|
|
73
|
+
Included with sshreader is a script called `pydsh`. This works very similar to[pdsh](https://computing.llnl.gov/linux/pdsh.html)
|
|
74
|
+
but uses sshreader at its core to perform ssh commands in parallel and return the results.
|
|
75
|
+
The output of `pydsh` can also be piped through the `dshbak` tool that comes with pdsh.
|
|
75
76
|
|
|
76
77
|
Pydsh uses [hostlist expressions](https://www.nsc.liu.se/~kent/python-hostlist/) to get its list of hosts
|
|
77
78
|
to process.
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
[tool.poetry]
|
|
2
|
+
name = "sshreader"
|
|
3
|
+
version = "6.0.0"
|
|
4
|
+
description = "Multi-threading/processing wrapper for Paramiko"
|
|
5
|
+
authors = ["Jesse Almanrode <jesse@almanrode.com>"]
|
|
6
|
+
license = "LGPL-3.0-or-later"
|
|
7
|
+
readme = "README.md"
|
|
8
|
+
homepage = "http://sshreader.readthedocs.io/"
|
|
9
|
+
repository = "https://bitbucket.org/isaiah1112/sshreader/"
|
|
10
|
+
classifiers = [
|
|
11
|
+
"Programming Language :: Python",
|
|
12
|
+
"Intended Audience :: Developers",
|
|
13
|
+
"License :: OSI Approved :: GNU Lesser General Public License v3 or later (LGPLv3+)",
|
|
14
|
+
"Development Status :: 5 - Production/Stable",
|
|
15
|
+
"Programming Language :: Python",
|
|
16
|
+
"Programming Language :: Python :: 3.8",
|
|
17
|
+
"Programming Language :: Python :: 3.9",
|
|
18
|
+
"Programming Language :: Python :: 3.10",
|
|
19
|
+
"Programming Language :: Python :: 3.11",
|
|
20
|
+
"Programming Language :: Python :: 3.12",
|
|
21
|
+
"Topic :: Software Development :: Libraries",
|
|
22
|
+
"Topic :: Software Development :: Libraries :: Python Modules"
|
|
23
|
+
]
|
|
24
|
+
packages = [{include = "sshreader"}, {include = "sshreader/scripts"}]
|
|
25
|
+
|
|
26
|
+
[tool.poetry.scripts]
|
|
27
|
+
pydsh = 'sshreader.scripts.pydsh:cli'
|
|
28
|
+
|
|
29
|
+
[tool.poetry.dependencies]
|
|
30
|
+
python = ">3.8,<3.13"
|
|
31
|
+
click = "^8"
|
|
32
|
+
colorama = "^0.4"
|
|
33
|
+
paramiko = "^3"
|
|
34
|
+
progressbar2 = "^4"
|
|
35
|
+
python-hostlist = "^1"
|
|
36
|
+
|
|
37
|
+
[tool.poetry.group.dev]
|
|
38
|
+
optional = true
|
|
39
|
+
|
|
40
|
+
[tool.poetry.group.dev.dependencies]
|
|
41
|
+
coverage = "^7"
|
|
42
|
+
discover = "^0.4"
|
|
43
|
+
flake8 = "^5"
|
|
44
|
+
|
|
45
|
+
[tool.poetry.group.docs]
|
|
46
|
+
optional = true
|
|
47
|
+
|
|
48
|
+
[tool.poetry.group.docs.dependencies]
|
|
49
|
+
sphinx = "^7"
|
|
50
|
+
|
|
51
|
+
[build-system]
|
|
52
|
+
requires = ["poetry-core"]
|
|
53
|
+
build-backend = "poetry.core.masonry.api"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# coding=utf-8
|
|
2
2
|
"""A Python Package for parallelizing ssh connections via threading and multiprocessing.
|
|
3
3
|
"""
|
|
4
|
-
# Copyright (C) 2015-
|
|
4
|
+
# Copyright (C) 2015-2024 Jesse Almanrode
|
|
5
5
|
#
|
|
6
6
|
# This program is free software: you can redistribute it and/or modify
|
|
7
7
|
# it under the terms of the GNU Lesser General Public License as published by
|
|
@@ -18,12 +18,12 @@
|
|
|
18
18
|
|
|
19
19
|
# For backwards compatibility
|
|
20
20
|
from .ssh import SSH, envvars
|
|
21
|
-
from .
|
|
21
|
+
from .customtypes import Command, EnvVars, Timeout, TimeoutTuple
|
|
22
22
|
from .utils import ServerJob, Hook, sshread, echo, cpu_limit, shell_command
|
|
23
23
|
import logging
|
|
24
24
|
|
|
25
25
|
__author__ = 'Jesse Almanrode (jesse@almanrode.com)'
|
|
26
|
-
__all__ = ['ssh', '
|
|
26
|
+
__all__ = ['ssh', 'customtypes', 'utils']
|
|
27
27
|
|
|
28
28
|
log = logging.getLogger(__name__)
|
|
29
29
|
log_handler = logging.StreamHandler()
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# coding=utf-8
|
|
2
2
|
""" Typing module for sshreader
|
|
3
3
|
"""
|
|
4
|
-
# Copyright (C) 2015-
|
|
4
|
+
# Copyright (C) 2015-2024 Jesse Almanrode
|
|
5
5
|
#
|
|
6
6
|
# This program is free software: you can redistribute it and/or modify
|
|
7
7
|
# it under the terms of the GNU Lesser General Public License as published by
|
|
@@ -34,4 +34,4 @@ class EnvVars(NamedTuple):
|
|
|
34
34
|
|
|
35
35
|
|
|
36
36
|
Timeout = Union[int, float]
|
|
37
|
-
TimeoutTuple = Tuple[Timeout]
|
|
37
|
+
TimeoutTuple = Tuple[Timeout, Timeout]
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# coding=utf-8
|
|
2
2
|
""" Scripts portion of sshreader package
|
|
3
3
|
"""
|
|
4
|
-
# Copyright (C) 2015-
|
|
4
|
+
# Copyright (C) 2015-2023 Jesse Almanrode
|
|
5
5
|
#
|
|
6
6
|
# This program is free software: you can redistribute it and/or modify
|
|
7
7
|
# it under the terms of the GNU Lesser General Public License as published by
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# coding=utf-8
|
|
2
2
|
""" A Pythonic implementation of pdsh powered by sshreader
|
|
3
3
|
"""
|
|
4
|
-
# Copyright (C) 2015-
|
|
4
|
+
# Copyright (C) 2015-2023 Jesse Almanrode
|
|
5
5
|
#
|
|
6
6
|
# This program is free software: you can redistribute it and/or modify
|
|
7
7
|
# it under the terms of the GNU Lesser General Public License as published by
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
#
|
|
16
16
|
# You should have received a copy of the GNU Lesser General Public License
|
|
17
17
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
18
|
+
|
|
18
19
|
from collections import defaultdict
|
|
19
20
|
from hashlib import md5
|
|
20
21
|
from hostlist import expand_hostlist, collect_hostlist
|
|
@@ -25,7 +26,7 @@ import sshreader
|
|
|
25
26
|
import sys
|
|
26
27
|
# GLOBALS
|
|
27
28
|
__author__ = 'Jesse Almanrode'
|
|
28
|
-
__version__ = '3.0
|
|
29
|
+
__version__ = '3.1.0'
|
|
29
30
|
__examples__ = """\b
|
|
30
31
|
Examples:
|
|
31
32
|
pydsh -w host1,host2,host3 "uname -r"
|
|
@@ -148,6 +149,7 @@ def validate_hostlist(ctx, param, value):
|
|
|
148
149
|
@click.option('--verbose', '-v', count=True, help='Increase debug verbosity')
|
|
149
150
|
@click.option('--redline', is_flag=True, help='Run pydsh faster')
|
|
150
151
|
@click.option('--port', default=22, help='SSH Port')
|
|
152
|
+
@click.option('--sha2', is_flag=True, default=True, help='Use SHA2 Hash Algorithm for Keys')
|
|
151
153
|
@click.argument('cmd', nargs=1)
|
|
152
154
|
def cli(**kwargs):
|
|
153
155
|
""" Run ssh commands in parallel across hosts
|
|
@@ -165,6 +167,7 @@ def cli(**kwargs):
|
|
|
165
167
|
mkpath = click.Path(exists=True, dir_okay=False)
|
|
166
168
|
script_path = mkpath(kwargs['cmd'])
|
|
167
169
|
script_name = os.path.split(script_path)[1]
|
|
170
|
+
log.info('Creating copy_script prehook for: ' + script_name)
|
|
168
171
|
prehook = sshreader.Hook(copy_script, args=[script_path], ssh_established=True)
|
|
169
172
|
with open(script_path) as s:
|
|
170
173
|
script = s.readline()
|
|
@@ -174,7 +177,7 @@ def cli(**kwargs):
|
|
|
174
177
|
sshenv = sshreader.envvars()
|
|
175
178
|
log.debug(sshenv)
|
|
176
179
|
|
|
177
|
-
if kwargs['port'] <= 0:
|
|
180
|
+
if kwargs['port'] <= 0 or not isinstance(kwargs['port'], int):
|
|
178
181
|
raise click.BadOptionUsage('port', 'Please enter a positive integer')
|
|
179
182
|
|
|
180
183
|
if kwargs['username'] is None:
|
|
@@ -185,6 +188,7 @@ def cli(**kwargs):
|
|
|
185
188
|
|
|
186
189
|
# By default, we prefer ssh keys
|
|
187
190
|
if not kwargs['keyfile']:
|
|
191
|
+
log.info('SSH keyfile not specified, searching for one anyways')
|
|
188
192
|
if any((sshenv.rsa_key, sshenv.dsa_key, sshenv.ecdsa_key)):
|
|
189
193
|
if sshenv.ecdsa_key:
|
|
190
194
|
kwargs['keyfile'] = sshenv.ecdsa_key
|
|
@@ -200,10 +204,11 @@ def cli(**kwargs):
|
|
|
200
204
|
if not all((kwargs['username'], kwargs['password'])):
|
|
201
205
|
raise click.ClickException('Unable to find ssh key to use and password not supplied.')
|
|
202
206
|
else:
|
|
203
|
-
log.info('
|
|
207
|
+
log.info('Falling back to SSH Agent')
|
|
204
208
|
if kwargs['keypass']:
|
|
205
209
|
kwargs['keypass'] = click.prompt('Private Key Password', hide_input=True)
|
|
206
210
|
else:
|
|
211
|
+
log.info('SSH keyfile provided disabling password authentication')
|
|
207
212
|
# If you specify an SSH key then we ignore any password or prompt flags you might have entered
|
|
208
213
|
kwargs['password'] = None
|
|
209
214
|
kwargs['prompt'] = False
|
|
@@ -216,10 +221,12 @@ def cli(**kwargs):
|
|
|
216
221
|
if not kwargs['keyfile'] and len(sshenv.agent_keys) == 0:
|
|
217
222
|
raise click.ClickException('Unable to find ssh key to use and password not supplied or prompt enabled.')
|
|
218
223
|
else:
|
|
224
|
+
log.info('Prompting for password and disabling discovered SSH keyfiles')
|
|
219
225
|
kwargs['keyfile'] = None
|
|
220
226
|
while kwargs['password'] is None:
|
|
221
227
|
kwargs['password'] = click.prompt(kwargs['username'] + "'s Password", hide_input=True)
|
|
222
228
|
else:
|
|
229
|
+
log.info('Using password authentication and disabling discovered SSH keyfiles')
|
|
223
230
|
# You provided a password, ignore the SSH key
|
|
224
231
|
kwargs['keyfile'] = None
|
|
225
232
|
|
|
@@ -227,19 +234,28 @@ def cli(**kwargs):
|
|
|
227
234
|
posthook = sshreader.Hook(target=output)
|
|
228
235
|
jobs = list()
|
|
229
236
|
for host in kwargs['hostlist']:
|
|
237
|
+
if ':' in host:
|
|
238
|
+
log.info('SSH Port declared in host: ' + host)
|
|
239
|
+
host, port = host.split(':')
|
|
240
|
+
log.debug((host, port))
|
|
241
|
+
else:
|
|
242
|
+
port = kwargs['port']
|
|
230
243
|
if kwargs['keyfile']:
|
|
231
244
|
job = sshreader.ServerJob(host, kwargs['cmd'], username=kwargs['username'], keyfile=kwargs['keyfile'],
|
|
232
|
-
key_pass=kwargs['keypass'], combine_output=True)
|
|
245
|
+
key_pass=kwargs['keypass'], combine_output=True, rsa_sha2=kwargs['sha2'])
|
|
233
246
|
else:
|
|
234
247
|
job = sshreader.ServerJob(host, kwargs['cmd'], username=kwargs['username'], password=kwargs['password'],
|
|
235
|
-
combine_output=True)
|
|
236
|
-
job.ssh_port =
|
|
248
|
+
combine_output=True, rsa_sha2=kwargs['sha2'])
|
|
249
|
+
job.ssh_port = port
|
|
237
250
|
if kwargs['dshbak'] is False and kwargs['coalesce'] is False:
|
|
251
|
+
log.info('Adding posthook to ServerJob for: ' + host)
|
|
238
252
|
job.post_hook = posthook
|
|
239
253
|
if kwargs['file']:
|
|
254
|
+
log.info('Adding prehook to ServerJob for: ' + host)
|
|
240
255
|
job.pre_hook = prehook
|
|
241
256
|
jobs.append(job)
|
|
242
257
|
|
|
258
|
+
log.info('Sending %s ServerJobs to sshreader module' % (len(jobs),))
|
|
243
259
|
if kwargs['dshbak'] is False and kwargs['coalesce'] is False:
|
|
244
260
|
if kwargs['redline']:
|
|
245
261
|
sshreader.sshread(jobs, pcount=0, tcount=0, print_lock=True)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# coding=utf-8
|
|
2
2
|
"""A wrapper for Paramiko that attempts to make ssh sessions easier to work with.
|
|
3
3
|
"""
|
|
4
|
-
# Copyright (C) 2015-
|
|
4
|
+
# Copyright (C) 2015-2024 Jesse Almanrode
|
|
5
5
|
#
|
|
6
6
|
# This program is free software: you can redistribute it and/or modify
|
|
7
7
|
# it under the terms of the GNU Lesser General Public License as published by
|
|
@@ -22,7 +22,7 @@ import socket
|
|
|
22
22
|
from getpass import getuser
|
|
23
23
|
from typing import Any, Optional
|
|
24
24
|
|
|
25
|
-
from .
|
|
25
|
+
from .customtypes import Command, EnvVars, Timeout
|
|
26
26
|
log = logging.getLogger('sshreader')
|
|
27
27
|
|
|
28
28
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# coding=utf-8
|
|
2
2
|
""" All the classes and functions that make sshreader tick
|
|
3
3
|
"""
|
|
4
|
-
# Copyright (C) 2015-
|
|
4
|
+
# Copyright (C) 2015-2024 Jesse Almanrode
|
|
5
5
|
#
|
|
6
6
|
# This program is free software: you can redistribute it and/or modify
|
|
7
7
|
# it under the terms of the GNU Lesser General Public License as published by
|
|
@@ -28,7 +28,7 @@ from typing import Any, Callable, Optional, Union
|
|
|
28
28
|
|
|
29
29
|
|
|
30
30
|
from .ssh import SSH
|
|
31
|
-
from .
|
|
31
|
+
from .customtypes import Command, Timeout, TimeoutTuple
|
|
32
32
|
|
|
33
33
|
# Globals
|
|
34
34
|
mpctx = multiprocessing.get_context('spawn') # Forcing the forking type to spawn in older versions of Python3
|
|
@@ -152,7 +152,7 @@ class ServerJob(object):
|
|
|
152
152
|
"""
|
|
153
153
|
def __init__(self, fqdn: str, cmds: Union[list, tuple, str], username: Optional[str] = None,
|
|
154
154
|
password: Optional[str] = None, keyfile: Optional[str] = None, key_pass: Optional[str] = None,
|
|
155
|
-
timeout: Optional[TimeoutTuple] = (0.5, 30), run_local: bool = False,
|
|
155
|
+
timeout: Optional[Union[Timeout, TimeoutTuple]] = (0.5, 30), run_local: bool = False,
|
|
156
156
|
pre_hook: Optional[Hook] = None, post_hook: Optional[Hook] = None,
|
|
157
157
|
combine_output: bool = False, ssh_port: int = 22, rsa_sha2: Optional[bool] = True) -> None:
|
|
158
158
|
self.name = str(fqdn)
|
sshreader-5.0.4/PKG-INFO
DELETED
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: sshreader
|
|
3
|
-
Version: 5.0.4
|
|
4
|
-
Summary: Multi-threading/processing wrapper for Paramiko
|
|
5
|
-
Home-page: http://sshreader.readthedocs.io/
|
|
6
|
-
Author: Jesse Almanrode
|
|
7
|
-
Author-email: jesse@almanrode.com
|
|
8
|
-
Project-URL: Documentation, http://sshreader.readthedocs.io/
|
|
9
|
-
Project-URL: Source, https://bitbucket.org/isaiah1112/sshreader/
|
|
10
|
-
Project-URL: Tracker, https://bitbucket.org/isaiah1112/sshreader/issues
|
|
11
|
-
Platform: Linux
|
|
12
|
-
Platform: Darwin
|
|
13
|
-
Classifier: Programming Language :: Python
|
|
14
|
-
Classifier: Intended Audience :: Developers
|
|
15
|
-
Classifier: License :: OSI Approved :: GNU Lesser General Public License v3 or later (LGPLv3+)
|
|
16
|
-
Classifier: Development Status :: 5 - Production/Stable
|
|
17
|
-
Classifier: Programming Language :: Python
|
|
18
|
-
Classifier: Programming Language :: Python :: 3.7
|
|
19
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
20
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
21
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
22
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
23
|
-
Classifier: Topic :: Software Development :: Libraries
|
|
24
|
-
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
25
|
-
Requires-Python: >=3.7
|
|
26
|
-
Description-Content-Type: text/markdown
|
|
27
|
-
License-File: LICENSE
|
|
28
|
-
License-File: LICENSE.lesser
|
|
29
|
-
|
|
30
|
-
# [sshreader][]
|
|
31
|
-
|
|
32
|
-
## Overview
|
|
33
|
-
|
|
34
|
-
[SSHreader][] is a Python Module for multiprocessing/threading ssh connections in order to make ssh operations
|
|
35
|
-
across multiple servers parallel. It utilizes the [Paramiko](http://www.paramiko.org/) module for its ssh client.
|
|
36
|
-
|
|
37
|
-
In order to maintain the widest range of compatibility, [SSHreader][] is currently tested using the following versions of
|
|
38
|
-
Python:
|
|
39
|
-
|
|
40
|
-
* Python3.7
|
|
41
|
-
* Python3.8
|
|
42
|
-
* Python3.9
|
|
43
|
-
* Python3.10
|
|
44
|
-
* Python3.11
|
|
45
|
-
|
|
46
|
-
## License
|
|
47
|
-
|
|
48
|
-
[SSHreader][] is released under [GNU Lesser General Public License v3.0][],
|
|
49
|
-
see the file LICENSE and LICENSE.lesser for the license text.
|
|
50
|
-
|
|
51
|
-
## Installation
|
|
52
|
-
|
|
53
|
-
The most straightforward way to get the [SSHreader][] module working for you is:
|
|
54
|
-
|
|
55
|
-
```commandline
|
|
56
|
-
pip install sshreader
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
This will ensure that all the requirements are met.
|
|
60
|
-
|
|
61
|
-
### Development Installation
|
|
62
|
-
|
|
63
|
-
If you are wanting to work on development of [SSHreader][] perform the following:
|
|
64
|
-
|
|
65
|
-
```commandline
|
|
66
|
-
make install
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
To ensure all development requirements are met. This will allow you to build the Sphinx Documentation for [SSHreader][]
|
|
70
|
-
or run the unit/integration tests!
|
|
71
|
-
|
|
72
|
-
## Documentation
|
|
73
|
-
|
|
74
|
-
The documentation for [SSHreader][] can be found [here](https://sshreader.readthedocs.io)
|
|
75
|
-
|
|
76
|
-
### Building Docs
|
|
77
|
-
|
|
78
|
-
If you have installed the requirements for [SSHreader][] you can build its Sphinx Documentation simply by:
|
|
79
|
-
|
|
80
|
-
```commandline
|
|
81
|
-
make docs
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
Then simply open `docs/build/html/index.html` in your browser.
|
|
85
|
-
|
|
86
|
-
## Contributing
|
|
87
|
-
|
|
88
|
-
Comments and enhancements are very welcome.
|
|
89
|
-
|
|
90
|
-
Report any issues or feature requests on the [BitBucket bug
|
|
91
|
-
tracker](https://bitbucket.org/isaiah1112/sshreader/issues?status=new&status=open). Please include a minimal
|
|
92
|
-
(not-) working example which reproduces the bug and, if appropriate, the
|
|
93
|
-
traceback information. Please do not request features already being worked
|
|
94
|
-
towards.
|
|
95
|
-
|
|
96
|
-
Code contributions are encouraged: please feel free to [fork the
|
|
97
|
-
project](https://bitbucket.org/isaiah1112/sshreader) and submit pull requests to the develop branch.
|
|
98
|
-
|
|
99
|
-
## Extras
|
|
100
|
-
|
|
101
|
-
Included with sshreader is a binary called **pydsh** (generally installed in /usr/local/bin/). This works very similar to
|
|
102
|
-
[pdsh](https://computing.llnl.gov/linux/pdsh.html) but uses sshreader at its core to perform ssh commands in parallel
|
|
103
|
-
and return the results. The output of *pydsh* can also be piped through the **dshbak** tool that comes with pdsh.
|
|
104
|
-
|
|
105
|
-
Pydsh uses [hostlist expressions](https://www.nsc.liu.se/~kent/python-hostlist/) to get its list of hosts
|
|
106
|
-
to process.
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
[GNU Lesser General Public License v3.0]: http://choosealicense.com/licenses/lgpl-3.0/ "LGPL v3"
|
|
110
|
-
|
|
111
|
-
[sshreader]: https://bitbucket.org/isaiah1112/sshreader "SSHreader Package"
|
sshreader-5.0.4/setup.cfg
DELETED
sshreader-5.0.4/setup.py
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
# coding=utf-8
|
|
2
|
-
"""Setup file for sshreader module"""
|
|
3
|
-
|
|
4
|
-
import setuptools
|
|
5
|
-
|
|
6
|
-
with open("README.md", "r", encoding="utf-8") as fh:
|
|
7
|
-
long_description = fh.read()
|
|
8
|
-
|
|
9
|
-
setuptools.setup(name='sshreader',
|
|
10
|
-
version='5.0.4',
|
|
11
|
-
author='Jesse Almanrode',
|
|
12
|
-
author_email='jesse@almanrode.com',
|
|
13
|
-
description='Multi-threading/processing wrapper for Paramiko',
|
|
14
|
-
long_description=long_description,
|
|
15
|
-
long_description_content_type="text/markdown",
|
|
16
|
-
url='http://sshreader.readthedocs.io/',
|
|
17
|
-
project_urls={'Documentation': 'http://sshreader.readthedocs.io/',
|
|
18
|
-
'Source': 'https://bitbucket.org/isaiah1112/sshreader/',
|
|
19
|
-
'Tracker': 'https://bitbucket.org/isaiah1112/sshreader/issues'},
|
|
20
|
-
packages=['sshreader', 'sshreader/scripts'],
|
|
21
|
-
include_package_data=True,
|
|
22
|
-
python_requires='>=3.7',
|
|
23
|
-
install_requires=['click>=8.1.3',
|
|
24
|
-
'colorama>=0.4.6',
|
|
25
|
-
'paramiko>=2.12.0',
|
|
26
|
-
'progressbar2>=4.2.0',
|
|
27
|
-
'python-hostlist>=1.22',
|
|
28
|
-
],
|
|
29
|
-
entry_points={'console_scripts': ['pydsh = sshreader.scripts.pydsh:cli']},
|
|
30
|
-
platforms=['Linux', 'Darwin'],
|
|
31
|
-
classifiers=[
|
|
32
|
-
'Programming Language :: Python',
|
|
33
|
-
'Intended Audience :: Developers',
|
|
34
|
-
'License :: OSI Approved :: GNU Lesser General Public License v3 or later (LGPLv3+)',
|
|
35
|
-
'Development Status :: 5 - Production/Stable',
|
|
36
|
-
'Programming Language :: Python',
|
|
37
|
-
'Programming Language :: Python :: 3.7',
|
|
38
|
-
'Programming Language :: Python :: 3.8',
|
|
39
|
-
'Programming Language :: Python :: 3.9',
|
|
40
|
-
'Programming Language :: Python :: 3.10',
|
|
41
|
-
'Programming Language :: Python :: 3.11',
|
|
42
|
-
'Topic :: Software Development :: Libraries',
|
|
43
|
-
'Topic :: Software Development :: Libraries :: Python Modules',
|
|
44
|
-
],
|
|
45
|
-
)
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
LICENSE
|
|
2
|
-
LICENSE.lesser
|
|
3
|
-
README.md
|
|
4
|
-
setup.py
|
|
5
|
-
sshreader/__init__.py
|
|
6
|
-
sshreader/ssh.py
|
|
7
|
-
sshreader/types.py
|
|
8
|
-
sshreader/utils.py
|
|
9
|
-
sshreader.egg-info/PKG-INFO
|
|
10
|
-
sshreader.egg-info/SOURCES.txt
|
|
11
|
-
sshreader.egg-info/dependency_links.txt
|
|
12
|
-
sshreader.egg-info/entry_points.txt
|
|
13
|
-
sshreader.egg-info/requires.txt
|
|
14
|
-
sshreader.egg-info/top_level.txt
|
|
15
|
-
sshreader/scripts/__init__.py
|
|
16
|
-
sshreader/scripts/pydsh.py
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
|
File without changes
|
|
File without changes
|