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

test_backup: add ssh diag on failure

parent 20fc2074
No related branches found
No related tags found
No related merge requests found
......@@ -34,6 +34,13 @@ def test_ssh(ip):
subprocess.check_output(cmd, shell=True, timeout=2)
print('%sLogged in successfully%s' % (GREEN, DEF))
except subprocess.CalledProcessError:
# do some diagnostics
try:
cmd_port = 'nc -z -w2 {} 22'.format(ip)
subprocess.check_output(cmd_port, shell=True, timeout=5)
except subprocess.CalledProcessError:
cmd_ping = 'ping -c2 -w4 {}'.format(ip)
subprocess.check_output(cmd_ping, shell=True, timeout=5)
print('%sFailed to login using SSH, run ssh-copy-id %s %s' % (RED, ip, DEF))
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