multiSSH3 5.39__tar.gz → 5.40__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.
Potentially problematic release.
This version of multiSSH3 might be problematic. Click here for more details.
- {multissh3-5.39 → multissh3-5.40}/PKG-INFO +1 -1
- {multissh3-5.39 → multissh3-5.40}/multiSSH3.egg-info/PKG-INFO +1 -1
- {multissh3-5.39 → multissh3-5.40}/multiSSH3.py +40 -21
- {multissh3-5.39 → multissh3-5.40}/setup.py +2 -1
- {multissh3-5.39 → multissh3-5.40}/LICENSE +0 -0
- {multissh3-5.39 → multissh3-5.40}/README.md +0 -0
- {multissh3-5.39 → multissh3-5.40}/multiSSH3.egg-info/SOURCES.txt +0 -0
- {multissh3-5.39 → multissh3-5.40}/multiSSH3.egg-info/dependency_links.txt +0 -0
- {multissh3-5.39 → multissh3-5.40}/multiSSH3.egg-info/entry_points.txt +0 -0
- {multissh3-5.39 → multissh3-5.40}/multiSSH3.egg-info/requires.txt +0 -0
- {multissh3-5.39 → multissh3-5.40}/multiSSH3.egg-info/top_level.txt +0 -0
- {multissh3-5.39 → multissh3-5.40}/setup.cfg +0 -0
|
@@ -1,13 +1,21 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
2
|
__curses_available = False
|
|
3
|
+
__resource_lib_available = False
|
|
3
4
|
try:
|
|
4
5
|
import curses
|
|
5
6
|
__curses_available = True
|
|
6
7
|
except ImportError:
|
|
7
8
|
pass
|
|
9
|
+
try:
|
|
10
|
+
import resource
|
|
11
|
+
__resource_lib_available = True
|
|
12
|
+
except ImportError:
|
|
13
|
+
pass
|
|
14
|
+
|
|
8
15
|
import subprocess
|
|
9
16
|
import threading
|
|
10
|
-
import time
|
|
17
|
+
import time
|
|
18
|
+
import os
|
|
11
19
|
import argparse
|
|
12
20
|
from itertools import product
|
|
13
21
|
import re
|
|
@@ -37,7 +45,7 @@ except AttributeError:
|
|
|
37
45
|
# If neither is available, use a dummy decorator
|
|
38
46
|
def cache_decorator(func):
|
|
39
47
|
return func
|
|
40
|
-
version = '5.
|
|
48
|
+
version = '5.40'
|
|
41
49
|
VERSION = version
|
|
42
50
|
|
|
43
51
|
CONFIG_FILE = '/etc/multiSSH3.config.json'
|
|
@@ -352,26 +360,34 @@ if True:
|
|
|
352
360
|
__curses_current_color_pair_index = 2 # Start from 1, as 0 is the default color pair
|
|
353
361
|
__curses_color_table = {}
|
|
354
362
|
__curses_current_color_index = 10
|
|
363
|
+
__max_connections_nofile_limit_supported = 0
|
|
364
|
+
if __resource_lib_available:
|
|
365
|
+
# Get the current limits
|
|
366
|
+
_, __system_nofile_limit = resource.getrlimit(resource.RLIMIT_NOFILE)
|
|
367
|
+
# Set the soft limit to the hard limit
|
|
368
|
+
resource.setrlimit(resource.RLIMIT_NOFILE, (__system_nofile_limit, __system_nofile_limit))
|
|
369
|
+
__max_connections_nofile_limit_supported = int((__system_nofile_limit - 5) / 4.6)
|
|
355
370
|
|
|
356
371
|
# Mapping of ANSI 4-bit colors to curses colors
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
372
|
+
if __curses_available:
|
|
373
|
+
ANSI_TO_CURSES_COLOR = {
|
|
374
|
+
30: curses.COLOR_BLACK,
|
|
375
|
+
31: curses.COLOR_RED,
|
|
376
|
+
32: curses.COLOR_GREEN,
|
|
377
|
+
33: curses.COLOR_YELLOW,
|
|
378
|
+
34: curses.COLOR_BLUE,
|
|
379
|
+
35: curses.COLOR_MAGENTA,
|
|
380
|
+
36: curses.COLOR_CYAN,
|
|
381
|
+
37: curses.COLOR_WHITE,
|
|
382
|
+
90: curses.COLOR_BLACK, # Bright Black (usually gray)
|
|
383
|
+
91: curses.COLOR_RED, # Bright Red
|
|
384
|
+
92: curses.COLOR_GREEN, # Bright Green
|
|
385
|
+
93: curses.COLOR_YELLOW, # Bright Yellow
|
|
386
|
+
94: curses.COLOR_BLUE, # Bright Blue
|
|
387
|
+
95: curses.COLOR_MAGENTA, # Bright Magenta
|
|
388
|
+
96: curses.COLOR_CYAN, # Bright Cyan
|
|
389
|
+
97: curses.COLOR_WHITE # Bright White
|
|
390
|
+
}
|
|
375
391
|
# ------------ Exportable Help Functions ----------------
|
|
376
392
|
# check if command sshpass is available
|
|
377
393
|
_binPaths = {}
|
|
@@ -2437,9 +2453,12 @@ def run_command_on_hosts(hosts = DEFAULT_HOSTS,commands = None,oneonone = DEFAUL
|
|
|
2437
2453
|
if not max_connections:
|
|
2438
2454
|
max_connections = 4 * os.cpu_count()
|
|
2439
2455
|
elif max_connections == 0:
|
|
2440
|
-
max_connections =
|
|
2456
|
+
max_connections = __max_connections_nofile_limit_supported
|
|
2441
2457
|
elif max_connections < 0:
|
|
2442
2458
|
max_connections = (-max_connections) * os.cpu_count()
|
|
2459
|
+
if __max_connections_nofile_limit_supported > 0 and max_connections > __max_connections_nofile_limit_supported:
|
|
2460
|
+
eprint(f"Warning: The number of maximum connections {max_connections} is larger than estimated limit {__max_connections_nofile_limit_supported} from ulimit nofile limit {__system_nofile_limit}, setting the maximum connections to {__max_connections_nofile_limit_supported}.")
|
|
2461
|
+
max_connections = __max_connections_nofile_limit_supported
|
|
2443
2462
|
if not commands:
|
|
2444
2463
|
commands = []
|
|
2445
2464
|
else:
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
from setuptools import setup
|
|
2
|
+
from multiSSH3 import version
|
|
2
3
|
|
|
3
4
|
setup(
|
|
4
5
|
name='multiSSH3',
|
|
5
|
-
version=
|
|
6
|
+
version=version,
|
|
6
7
|
description='Run commands on multiple hosts via SSH',
|
|
7
8
|
long_description=open('README.md').read(),
|
|
8
9
|
long_description_content_type='text/markdown',
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|