From 08118105c18ef6c4267b5dcba4051f69d45eb8bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florent=20Thi=C3=A9ry?= <florent.thiery@ubicast.eu> Date: Thu, 23 Feb 2017 17:20:27 +0100 Subject: [PATCH] fix ssh test refs #20596 --- tests/test_mediaworker.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tests/test_mediaworker.py b/tests/test_mediaworker.py index 2d782d6e..1cd97df7 100755 --- a/tests/test_mediaworker.py +++ b/tests/test_mediaworker.py @@ -22,13 +22,14 @@ es_utils = imp.load_source('es_utils', '../utils.py') conf = es_utils.load_conf() def check_ssh(ip): - cmd = 'timeout 2 ssh -o StrictHostKeyChecking=no %s ls /tmp' % ip + cmd = '/usr/bin/ssh -o StrictHostKeyChecking=no -o PasswordAuthentication=no %s ls /tmp' % ip print('Connecting: %s' % cmd) - status, output = subprocess.getstatusoutput(cmd) - if status != 0: - print('%sFailed to login using SSH%s' % (RED, DEF)) + try: + subprocess.check_output(cmd, shell=True, timeout=2) + print('%sLogged in successfully%s' % (GREEN, DEF)) + except subprocess.CalledProcessError: + print('%sFailed to login using SSH, run ssh-copy-id %s %s' % (RED, ip, DEF)) return False - print('%sLogged in successfully%s' % (GREEN, DEF)) return True all_ok = True -- GitLab