From ed8337414c35771fabb8334a7c95decfa6bd762c Mon Sep 17 00:00:00 2001 From: Loic Guegan Date: Sun, 29 Oct 2023 09:46:58 +0100 Subject: Minor changes --- clusterman/commands/node.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'clusterman/commands/node.py') diff --git a/clusterman/commands/node.py b/clusterman/commands/node.py index 4d7b762..1b5a2ed 100644 --- a/clusterman/commands/node.py +++ b/clusterman/commands/node.py @@ -32,11 +32,10 @@ def scan(timeout): print("Skipping {}".format(ip)) continue print("Contacting {}...".format(ip),end='') - try: - subprocess.run(["ping", "-c", "1", "-W", str(timeout), ip],capture_output=True,check=True) + if not utils.ping_test(ip): nodes.append(ip) print("=> Found!!") - except: + else: print() with open(CONF.NODE_FILE, "w") as f: f.write(json.dumps(nodes,indent=4)) @@ -52,10 +51,9 @@ def check(timeout): fail=False for ip in nodes: print("Contacting {}...".format(ip),end='') - try: - subprocess.run(["ping", "-c", "1", "-W", str(timeout), ip],capture_output=True,check=True) + if not utils.ping_test(ip,timeout): print() - except: + else: fail=True print("=> Not responding!!") if not fail: -- cgit v1.2.3