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

Added celerity version check (refs #23674).

parent 8fe04a8a
No related branches found
No related tags found
No related merge requests found
......@@ -34,7 +34,7 @@ conf = es_utils.load_conf()
def check_ssh(ip):
cmd = 'ssh -o StrictHostKeyChecking=no -o PasswordAuthentication=no %s ls /tmp' % ip
cmd = 'ssh -o StrictHostKeyChecking=no -o PasswordAuthentication=no root@%s ls /tmp' % ip
print('Connecting to MediaWorker:\n%s' % cmd)
try:
subprocess.check_output(cmd, shell=True, timeout=5)
......@@ -47,10 +47,10 @@ def check_ssh(ip):
def run_tests(ip):
print('Updating envsetup tests on MediaWorker.')
cmd = 'ssh -t %s /root/envsetup/update_envsetup.py' % ip
cmd = 'ssh -t root@%s /root/envsetup/update_envsetup.py' % ip
os.system(cmd)
print('Running envsetup tests on MediaWorker.')
cmd = 'ssh -t %s /root/envsetup/tester.py' % ip
cmd = 'ssh -t root@%s /root/envsetup/tester.py' % ip
status = os.system(cmd)
if status == 0:
subprocess.check_output(cmd, shell=True, timeout=60)
......@@ -63,7 +63,7 @@ def run_tests(ip):
def check_celerity_connectivity(ip):
print('Getting celerity server url.')
cmd = 'ssh -t %s cat /etc/celerity/config.py' % ip
cmd = 'ssh -t root@%s cat /etc/celerity/config.py' % ip
print(cmd)
try:
d = subprocess.check_output(cmd, shell=True, timeout=5, universal_newlines=True)
......@@ -76,7 +76,7 @@ def check_celerity_connectivity(ip):
return False
server_url = m.groups()[0].strip('"\' ')
print('Checking celerity connectivity.')
cmd = 'ssh -t %s curl -k %s' % (ip, server_url)
cmd = 'ssh -t root@%s curl -k %s' % (ip, server_url)
print(cmd)
try:
d = subprocess.check_output(cmd, shell=True, timeout=5, universal_newlines=True)
......@@ -89,7 +89,26 @@ def check_celerity_connectivity(ip):
return False
def check_celerity_versions(ip):
print('Checking tha celerity server and worker uses the same version.')
cmd = 'diff -Naur <(dpkg -s celerity-utils) <(ssh -t root@%s dpkg -s celerity-utils)' % ip
print(cmd)
try:
out = subprocess.check_output(cmd, shell=True, timeout=5, universal_newlines=True)
except subprocess.CalledProcessError as e:
print('%sFailed to check celerity version in MediaWorker "%s":\n%s%s' % (RED, ip, e, DEF))
return False
out = out.strip()
if out:
print('%sThe celerity version in MediaWorker "%s" is not the same as in MediaServer:\n%s%s' % (RED, ip, out, DEF))
return False
print('%sThe celerity version in MediaWorker "%s" is the same as in MediaServer.%s' % (GREEN, ip, DEF))
return True
def check_mediaworker_in_whitelist(ip):
# this check is not usefull anymore because the worker uses the
# API to get links to resources with valid secure link token
nginx_vhosts_path = '/etc/nginx/sites-enabled'
vhosts = os.listdir(nginx_vhosts_path)
for v in vhosts:
......@@ -116,10 +135,12 @@ for worker_ip in worker_ips.split(','):
else:
if not check_celerity_connectivity(worker_ip):
all_ok = False
if not check_celerity_versions(worker_ip):
all_ok = False
# if not run_tests(worker_ip):
# all_ok = False
if not check_mediaworker_in_whitelist(worker_ip):
all_ok = False
# if not check_mediaworker_in_whitelist(worker_ip):
# all_ok = False
if not tested:
print('Celerity IP not set or running locally, skipping test.')
sys.exit(2)
......
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