multiCMD 1.24__py3-none-any.whl → 1.26__py3-none-any.whl
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.
- multiCMD.py +21 -4
- {multicmd-1.24.dist-info → multicmd-1.26.dist-info}/METADATA +1 -1
- multicmd-1.26.dist-info/RECORD +6 -0
- multicmd-1.24.dist-info/RECORD +0 -6
- {multicmd-1.24.dist-info → multicmd-1.26.dist-info}/WHEEL +0 -0
- {multicmd-1.24.dist-info → multicmd-1.26.dist-info}/entry_points.txt +0 -0
- {multicmd-1.24.dist-info → multicmd-1.26.dist-info}/top_level.txt +0 -0
multiCMD.py
CHANGED
@@ -18,7 +18,7 @@ import re
|
|
18
18
|
import itertools
|
19
19
|
import signal
|
20
20
|
|
21
|
-
version = '1.
|
21
|
+
version = '1.26'
|
22
22
|
__version__ = version
|
23
23
|
|
24
24
|
__running_threads = []
|
@@ -265,7 +265,7 @@ def __run_command(task,sem, timeout=60, quiet=False,dry_run=False,with_stdErr=Fa
|
|
265
265
|
return task.stdout
|
266
266
|
|
267
267
|
def ping(hosts,timeout=1,max_threads=0,quiet=True,dry_run=False,with_stdErr=False,
|
268
|
-
return_code_only=
|
268
|
+
return_code_only=False,return_object=False,wait_for_return=True,return_true_false=True):
|
269
269
|
'''
|
270
270
|
Ping multiple hosts
|
271
271
|
|
@@ -283,10 +283,27 @@ def ping(hosts,timeout=1,max_threads=0,quiet=True,dry_run=False,with_stdErr=Fals
|
|
283
283
|
@returns:
|
284
284
|
None | int | list[str] | Task: The output of the command
|
285
285
|
'''
|
286
|
-
|
287
|
-
|
286
|
+
single_host = False
|
287
|
+
if isinstance(hosts,str):
|
288
|
+
commands = [f'ping -c 1 {hosts}']
|
289
|
+
single_host = True
|
290
|
+
else:
|
291
|
+
commands = [f'ping -c 1 {host}' for host in hosts]
|
292
|
+
if return_true_false:
|
293
|
+
return_code_only = True
|
294
|
+
results = run_commands(commands, timeout=timeout, max_threads=max_threads, quiet=quiet,
|
288
295
|
dry_run=dry_run, with_stdErr=with_stdErr, return_code_only=return_code_only,
|
289
296
|
return_object=return_object,wait_for_return=wait_for_return)
|
297
|
+
if return_true_false:
|
298
|
+
if single_host:
|
299
|
+
return not results[0]
|
300
|
+
else:
|
301
|
+
return [not result for result in results]
|
302
|
+
else:
|
303
|
+
if single_host:
|
304
|
+
return results[0]
|
305
|
+
else:
|
306
|
+
return results
|
290
307
|
|
291
308
|
|
292
309
|
def run_command(command, timeout=0,max_threads=1,quiet=False,dry_run=False,with_stdErr=False,
|
@@ -0,0 +1,6 @@
|
|
1
|
+
multiCMD.py,sha256=NIUkbXTFdCTQJb6QMuAAhf6cJoiDwZ0vZ0H721ND85c,18750
|
2
|
+
multicmd-1.26.dist-info/METADATA,sha256=Xy_tztr92dFb0cszDrbVGHeI4SOybpmhYTEP0IIqUJ0,5640
|
3
|
+
multicmd-1.26.dist-info/WHEEL,sha256=jB7zZ3N9hIM9adW7qlTAyycLYW9npaWKLRzaoVcLKcM,91
|
4
|
+
multicmd-1.26.dist-info/entry_points.txt,sha256=nSLBkYrcUCQxt1w3LIJkvgOhpRYEC0xAPqNG7u4OYs8,89
|
5
|
+
multicmd-1.26.dist-info/top_level.txt,sha256=DSqgftD40G09F3qEjpHRCUNUsGUvGZZG69Sm3YEUiWI,9
|
6
|
+
multicmd-1.26.dist-info/RECORD,,
|
multicmd-1.24.dist-info/RECORD
DELETED
@@ -1,6 +0,0 @@
|
|
1
|
-
multiCMD.py,sha256=AM0rBKH_o_3JJKWfaHCn6QXZ152MSJPlN28o5YptWxY,18370
|
2
|
-
multicmd-1.24.dist-info/METADATA,sha256=Ht4tg-mMMWeEU8XK4vIu1gITGXvtF13FSDykZ4Wz5Jc,5640
|
3
|
-
multicmd-1.24.dist-info/WHEEL,sha256=jB7zZ3N9hIM9adW7qlTAyycLYW9npaWKLRzaoVcLKcM,91
|
4
|
-
multicmd-1.24.dist-info/entry_points.txt,sha256=nSLBkYrcUCQxt1w3LIJkvgOhpRYEC0xAPqNG7u4OYs8,89
|
5
|
-
multicmd-1.24.dist-info/top_level.txt,sha256=DSqgftD40G09F3qEjpHRCUNUsGUvGZZG69Sm3YEUiWI,9
|
6
|
-
multicmd-1.24.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|