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

Removed CELERITY_WORKER_IP variable | refs #32546

parent 3b34059a
No related branches found
No related tags found
No related merge requests found
......@@ -100,9 +100,6 @@ DB_PG_ROOT_PWD=''
CELERITY_SIGNING_KEY='test'
# ⚠ CELERITY_SERVER is used in ubicast-mediaserver package when adding an instance
CELERITY_SERVER='127.0.0.1'
# ⚠ CELERITY_WORKER_IP is used in ubicast-mediaserver package when adding an instance
# worker IP adresses, use commas to separate values
CELERITY_WORKER_IP='127.0.0.1'
# -- Network configuration --
# applied with client configuration step
......
......@@ -96,6 +96,30 @@ def run_tests(ip):
return False
def get_remote_workers_ips():
'''
Returns the list of IP addresses of all non local celerity workers.
'''
ips = set()
# get worker IPs
try:
from celerity_utils import api
success, response = api.list_workers('celerity_config_updater')
if not success:
raise Exception(str(response))
for worker in response['workers']:
if worker['remote_ip']:
ips.add(worker['remote_ip'])
except Exception as e:
u.error('Failed to get workers list using celerity API: %s' % e)
# remove local IP
p = subprocess.run(['ip', 'addr'], stdin=subprocess.DEVNULL, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, encoding='utf-8')
local_ips = re.findall(r'inet ([\d\.]+)/', p.stdout)
u.log('Local IP addresses are: %s.' % local_ips)
ips.difference(set(local_ips))
return ips
def main():
try:
import mediaserver
......@@ -107,11 +131,10 @@ def main():
all_ok = True
tested = False
mediaserver_ip = u.get_conf('NETWORK_IP')
worker_ips = u.get_conf('CELERITY_WORKER_IP')
for worker_ip in worker_ips.split(','):
worker_ips = get_remote_workers_ips()
for worker_ip in worker_ips:
worker_ip = worker_ip.strip()
if worker_ip and not worker_ip.startswith('127.0.') and worker_ip != mediaserver_ip:
if worker_ip and not worker_ip.startswith('127.'):
tested = True
if not check_ssh(worker_ip):
all_ok = False
......@@ -123,7 +146,7 @@ def main():
# if not run_tests(worker_ip):
# all_ok = False
if not tested:
u.log('Celerity IP not set or running locally, skipping test.')
u.log('No remote worker found, skipping test.')
return 2
if not all_ok:
......
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