From 4f4f515d02790cf303c868e88aa97c74fc3dcb61 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:32:07 +0100 Subject: [PATCH] also check apt, refs #20596 --- tests/test_mediaworker.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/tests/test_mediaworker.py b/tests/test_mediaworker.py index 1cd97df7..8e489986 100755 --- a/tests/test_mediaworker.py +++ b/tests/test_mediaworker.py @@ -22,7 +22,7 @@ es_utils = imp.load_source('es_utils', '../utils.py') conf = es_utils.load_conf() def check_ssh(ip): - cmd = '/usr/bin/ssh -o StrictHostKeyChecking=no -o PasswordAuthentication=no %s ls /tmp' % ip + cmd = 'ssh -o StrictHostKeyChecking=no -o PasswordAuthentication=no %s ls /tmp' % ip print('Connecting: %s' % cmd) try: subprocess.check_output(cmd, shell=True, timeout=2) @@ -32,11 +32,21 @@ def check_ssh(ip): return False return True +def check_apt(ip): + cmd = 'ssh %s apt-get update' % ip + try: + subprocess.check_output(cmd, shell=True, timeout=10) + print('%sapt-get update success on MediaWorker%s' % (GREEN, DEF)) + except subprocess.CalledProcessError: + print('%apt-get update failed on MediaWorker%s' % (RED, DEF)) + return False + all_ok = True worker_ip = conf.get('CELERITY_WORKER_IP') if worker_ip != '127.0.1.1': if not check_ssh(worker_ip): all_ok = False - + if not check_apt(worker_ip): + all_ok = False sys.exit(int(not all_ok)) -- GitLab