Skip to content
Snippets Groups Projects
Commit 59e03ecf authored by Nicolas KAROLAK's avatar Nicolas KAROLAK
Browse files

fix(test): ssh diagnostic backup

parent 6b9c3bd4
No related branches found
No related tags found
No related merge requests found
......@@ -42,14 +42,17 @@ def test_ssh(host: str) -> bool:
u.error("failed to login using SSH public key authentication")
return False
except subprocess.TimeoutExpired:
u.error("timeout")
try:
cmd_port = "nc -z -w2 {} 22".format(host)
subprocess.check_output(cmd_port, shell=True, timeout=5)
u.error("failed to bind SSH port")
except subprocess.CalledProcessError:
cmd_ping = "ping -c2 -w4 {}".format(host)
subprocess.check_output(cmd_ping, shell=True, timeout=15)
u.error("failed to ping host")
u.error("failed to bind SSH port")
try:
cmd_ping = "ping -c2 -w4 {}".format(host)
subprocess.check_output(cmd_ping, shell=True, timeout=15)
except subprocess.CalledProcessError:
u.error("failed to ping host")
return False
return True
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment