multiCMD 1.25__tar.gz → 1.26__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.
- {multicmd-1.25 → multicmd-1.26}/PKG-INFO +1 -1
- {multicmd-1.25 → multicmd-1.26}/multiCMD.egg-info/PKG-INFO +1 -1
- {multicmd-1.25 → multicmd-1.26}/multiCMD.py +19 -7
- {multicmd-1.25 → multicmd-1.26}/README.md +0 -0
- {multicmd-1.25 → multicmd-1.26}/multiCMD.egg-info/SOURCES.txt +0 -0
- {multicmd-1.25 → multicmd-1.26}/multiCMD.egg-info/dependency_links.txt +0 -0
- {multicmd-1.25 → multicmd-1.26}/multiCMD.egg-info/entry_points.txt +0 -0
- {multicmd-1.25 → multicmd-1.26}/multiCMD.egg-info/requires.txt +0 -0
- {multicmd-1.25 → multicmd-1.26}/multiCMD.egg-info/top_level.txt +0 -0
- {multicmd-1.25 → multicmd-1.26}/setup.cfg +0 -0
- {multicmd-1.25 → multicmd-1.26}/setup.py +0 -0
@@ -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,15 +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
|
+
single_host = False
|
286
287
|
if isinstance(hosts,str):
|
287
288
|
commands = [f'ping -c 1 {hosts}']
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
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,
|
293
295
|
dry_run=dry_run, with_stdErr=with_stdErr, return_code_only=return_code_only,
|
294
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
|
295
307
|
|
296
308
|
|
297
309
|
def run_command(command, timeout=0,max_threads=1,quiet=False,dry_run=False,with_stdErr=False,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|