summaryrefslogtreecommitdiff
path: root/clusterman
diff options
context:
space:
mode:
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: