Commit 2f1f6771 authored by David Mendez's avatar David Mendez
Browse files

Finally fix Conext url bug!

parent 4791db7d
......@@ -25,8 +25,9 @@ def get_context_url(context_dict):
:param context_dict: dict describing the context
"""
host = re.search(r'[^/]+\.ebi\.ac\.uk(:\d+)?', context_dict["delayed_jobs_base_url"]).group(0)
host_to_map = re.sub(r':.*$', '', host) # Remove port information to avoid annoyances with k8s changing the node ports
host_mappings = RUN_CONFIG.get('delayed_jobs', {}).get('server_mapping', {})
mapped_host = host_mappings.get(host)
mapped_host = host_mappings.get(host_to_map)
mapped_base_url = context_dict['delayed_jobs_base_url'].replace(host, mapped_host)
# Make sure to always use http because connection is internal
......
......@@ -6,7 +6,6 @@ import re
from app.context_loader import context_loader
from app.config import RUN_CONFIG
from app import app_logging
class TestContextLoader(unittest.TestCase):
......@@ -26,12 +25,8 @@ class TestContextLoader(unittest.TestCase):
host = re.search(r'[^/]+\.ebi\.ac\.uk(:\d+)?', context_dict["delayed_jobs_base_url"]).group(0)
host = re.sub(r':.*$', '', host) # Remove port information to avoid annoyances with k8s changing the node ports
app_logging.info('host: ')
app_logging.info(host)
host_mappings = RUN_CONFIG.get('delayed_jobs', {}).get('server_mapping', {})
app_logging.info(host_mappings)
mapped_host = host_mappings.get(host)
app_logging.info(mapped_host)
mapped_base_url = context_dict['delayed_jobs_base_url'].replace(host, mapped_host)
base_url_with_correct_schema = mapped_base_url.replace('https://', 'http://')
......
......@@ -249,7 +249,8 @@ paths:
enum: ['https://www.ebi.ac.uk/chembl/interface_api/delayed_jobs',
'http://www.ebi.ac.uk/chembl/interface_api/delayed_jobs',
'https://wwwdev.ebi.ac.uk/chembl/interface_api/delayed_jobs',
'http://wwwdev.ebi.ac.uk/chembl/interface_api/delayed_jobs']
'http://wwwdev.ebi.ac.uk/chembl/interface_api/delayed_jobs',
'http://hh-rke-wp-webadmin-04-worker-1.caas.ebi.ac.uk:30959/chembl/interface_api/delayed_jobs']
responses:
'200':
description: "success"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment