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: ...@@ -42,14 +42,17 @@ def test_ssh(host: str) -> bool:
u.error("failed to login using SSH public key authentication") u.error("failed to login using SSH public key authentication")
return False return False
except subprocess.TimeoutExpired: except subprocess.TimeoutExpired:
u.error("timeout")
try: try:
cmd_port = "nc -z -w2 {} 22".format(host) cmd_port = "nc -z -w2 {} 22".format(host)
subprocess.check_output(cmd_port, shell=True, timeout=5) subprocess.check_output(cmd_port, shell=True, timeout=5)
u.error("failed to bind SSH port")
except subprocess.CalledProcessError: except subprocess.CalledProcessError:
cmd_ping = "ping -c2 -w4 {}".format(host) u.error("failed to bind SSH port")
subprocess.check_output(cmd_ping, shell=True, timeout=15) try:
u.error("failed to ping host") 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 False
return True 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