Skip to content
Snippets Groups Projects
Commit ac988bd4 authored by Florent Thiery's avatar Florent Thiery
Browse files

check mediaworker ip is in nginx whitelist, fixes #20809

parent 9160e270
No related branches found
No related tags found
No related merge requests found
...@@ -74,6 +74,18 @@ def check_celerity_connectivity(ip): ...@@ -74,6 +74,18 @@ def check_celerity_connectivity(ip):
print('%sFailed to reach tasks server from MediaWorker "%s".%s' % (RED, ip, DEF)) print('%sFailed to reach tasks server from MediaWorker "%s".%s' % (RED, ip, DEF))
return False return False
def check_mediaworker_in_whitelist(ip):
nginx_vhosts_path = '/etc/nginx/sites-enabled'
vhosts = os.listdir(nginx_vhosts_path)
for v in vhosts:
if v.endswith('.conf'):
with f as open(os.path.join(nginx_vhosts_path, v), 'r'):
d = f.read()
if 'msuser_whitelist' in d:
if not ip in d:
print('MediaWorker ip is not in %s whitelist' % v)
return False
return True
all_ok = True all_ok = True
tested = False tested = False
...@@ -90,6 +102,8 @@ for worker_ip in worker_ips.split(','): ...@@ -90,6 +102,8 @@ for worker_ip in worker_ips.split(','):
all_ok = False all_ok = False
#if not run_tests(worker_ip): #if not run_tests(worker_ip):
# all_ok = False # all_ok = False
if not check_mediaworker_in_whitelist(worker_ip):
all_ok = False
if not tested: if not tested:
print('Celerity IP not set or running locally, skipping test.') print('Celerity IP not set or running locally, skipping test.')
sys.exit(2) 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