summaryrefslogtreecommitdiff
path: root/clusterman
diff options
context:
space:
mode:
authorLoic Guegan <loic.guegan@mailbox.org>2023-10-27 13:52:37 +0200
committerLoic Guegan <loic.guegan@mailbox.org>2023-10-27 13:52:37 +0200
commit839f4d5a30f2659550361fa473253afb5786f444 (patch)
tree242fa75517e2a626f319d0a0bb5123131fe5da7d /clusterman
parenteb0864ac65be62e60272f539d429f32a29ed8b7d (diff)
Minor changes
Diffstat (limited to 'clusterman')
-rw-r--r--clusterman/commands/node.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/clusterman/commands/node.py b/clusterman/commands/node.py
index 1ecd385..6aec92a 100644
--- a/clusterman/commands/node.py
+++ b/clusterman/commands/node.py
@@ -76,13 +76,13 @@ def check(timeout):
fail=False
for ip in nodes:
print("Contacting {}...".format(ip),end='')
- response = os.system("ping -c 1 -W " + str(timeout)+ " " + ip + " &>/dev/null")
- if response == 0:
- print("")
- else:
+ try:
+ subprocess.run(["ping", "-c", "1", "-W", str(timeout), ip],capture_output=True,check=True)
+ nodes.append(ip)
+ print()
+ except:
fail=True
- print("=> Not responding!!")
-
+ print("=> Not responding!!")
if not fail:
print("Success: All nodes are reachable")
else: