Skip to content
Snippets Groups Projects
Commit b3095c1c authored by Stéphane Diemer's avatar Stéphane Diemer
Browse files

Changed worker test (refs #21016).

parent 01b5ad33
No related branches found
No related tags found
No related merge requests found
...@@ -4,10 +4,11 @@ ...@@ -4,10 +4,11 @@
Criticality: High Criticality: High
Checks that MediaWorker can be reached using SSH and that it can reach the tasks server Checks that MediaWorker can be reached using SSH and that it can reach the tasks server
''' '''
import os
import imp import imp
import sys import os
import re
import subprocess import subprocess
import sys
GREEN = '\033[92m' GREEN = '\033[92m'
RED = '\033[91m' RED = '\033[91m'
...@@ -46,7 +47,7 @@ def check_ssh(ip): ...@@ -46,7 +47,7 @@ def check_ssh(ip):
def run_tests(ip): def run_tests(ip):
print('Updating envsetup tests on MediaWorker.') print('Updating envsetup tests on MediaWorker.')
cmd = 'ssh -t %s cd /root/envsetup && git pull' % ip cmd = 'ssh -t %s /root/envsetup/update_envsetup.py' % ip
os.system(cmd) os.system(cmd)
print('Running envsetup tests on MediaWorker.') print('Running envsetup tests on MediaWorker.')
cmd = 'ssh -t %s /root/envsetup/tester.py' % ip cmd = 'ssh -t %s /root/envsetup/tester.py' % ip
...@@ -61,9 +62,22 @@ def run_tests(ip): ...@@ -61,9 +62,22 @@ def run_tests(ip):
def check_celerity_connectivity(ip): def check_celerity_connectivity(ip):
h = conf.get('MS_SERVER_NAME') print('Getting celerity server url.')
cmd = 'ssh %s curl -k https://%s:6200' % (ip, h) cmd = 'ssh -t %s cat /etc/celerity/config.py' % ip
print('Checking celerity connectivity: %s' % cmd) print(cmd)
try:
d = subprocess.check_output(cmd, shell=True, timeout=5, universal_newlines=True)
except subprocess.CalledProcessError:
m = None
else:
m = re.search(r'\nSERVER_URL\s*=\s*([:\/\'\"\-\_\.\w]+)', d)
if not m:
print('%sFailed to get celerity tasks server url from configuration in MediaWorker "%s".%s' % (RED, ip, DEF))
return False
server_url = m.groups()[0].strip('"\' ')
print('Checking celerity connectivity.')
cmd = 'ssh -t %s curl -k %s' % (ip, server_url)
print(cmd)
try: try:
d = subprocess.check_output(cmd, shell=True, timeout=5, universal_newlines=True) d = subprocess.check_output(cmd, shell=True, timeout=5, universal_newlines=True)
except subprocess.CalledProcessError: except subprocess.CalledProcessError:
......
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