Commit dc52c0a7 authored by Georgios D. Tsoukalas's avatar Georgios D. Tsoukalas

service catalogs: autofill endpoints from BASE_URL

parent e7042ebd
......@@ -39,7 +39,7 @@ astakos_services = {
'prefix': 'account',
'public': True,
'endpoints': [
{'version': 'v1.0',
{'versionId': 'v1.0',
'publicURL': None},
]},
......@@ -49,7 +49,7 @@ astakos_services = {
'prefix': 'identity',
'public': True,
'endpoints': [
{'version': 'v2.0',
{'versionId': 'v2.0',
'publicURL': None},
]},
......@@ -59,7 +59,7 @@ astakos_services = {
'prefix': 'ui',
'public': False,
'endpoints': [
{'version': 'v1.0',
{'versionId': 'v1.0',
'publicURL': None},
]},
}
from django.conf import settings
from synnefo_branding import settings as synnefo_settings
from synnefo.lib import parse_base_url
from astakosclient import astakos_services
from astakosclient import astakos_services as vanilla_astakos_services
from synnefo.util.keypath import get_path
from synnefo.lib import join_urls
......
......@@ -35,15 +35,15 @@ from synnefo.lib import join_urls
from synnefo.util.keypath import get_path, set_path
def fill_in_endpoints(services, base_url):
def fill_endpoints(services, base_url):
for name, service in services.iteritems():
prefix = get_path(service, 'prefix')
endpoints = get_path(service, 'endpoints')
for name, endpoint in endpoints.iteritems():
version = get_path('versionId')
publicURL = get_path('publicURL')
for endpoint in endpoints:
version = get_path(endpoint, 'versionId')
publicURL = get_path(endpoint, 'publicURL')
if publicURL is not None:
continue
publicURL = join_urls(base_url, prefix, version)
set_path('publicURL', publicURL)
set_path(endpoint, 'publicURL', publicURL)
......@@ -41,7 +41,7 @@ cyclades_services = {
'prefix': 'compute',
'public': True,
'endpoints': [
{'version': 'v2.0',
{'versionId': 'v2.0',
'publicURL': None},
]},
......@@ -51,7 +51,7 @@ cyclades_services = {
'prefix': 'image',
'public': True,
'endpoints': [
{'version': 'v1',
{'versionId': 'v1',
'publicURL': None}
]},
......@@ -61,7 +61,7 @@ cyclades_services = {
'prefix': 'vmapi',
'public': True,
'endpoints': [
{'version': 'v1.0',
{'versionId': 'v1.0',
'publicURL': None},
]},
......@@ -71,7 +71,7 @@ cyclades_services = {
'prefix': 'helpdesk',
'public': False,
'endpoints': [
{'version': '',
{'versionId': '',
'publicURL': None},
]},
......@@ -81,7 +81,7 @@ cyclades_services = {
'prefix': 'userdata',
'public': False,
'endpoints': [
{'version': '',
{'versionId': '',
'publicURL': None},
]},
......@@ -91,7 +91,7 @@ cyclades_services = {
'prefix': 'ui',
'public': False,
'endpoints': [
{'version': '',
{'versionId': '',
'publicURL': None},
]},
}
......@@ -35,6 +35,7 @@ from django.conf import settings
from synnefo.lib import join_urls, parse_base_url
from synnefo.util.keypath import get_path
from synnefo.api.services import cyclades_services as vanilla_cyclades_services
from synnefo.lib.services import fill_endpoints
from astakosclient import astakos_services
from copy import deepcopy
......@@ -48,6 +49,7 @@ BASE_HOST, BASE_PATH = parse_base_url(BASE_URL)
CUSTOMIZE_SERVICES = getattr(settings, 'CYCLADES_CUSTOMIZE_SERVICES', ())
cyclades_services = deepcopy(vanilla_cyclades_services)
fill_endpoints(cyclades_services, BASE_URL)
for path, value in CUSTOMIZE_SERVICES:
set_path(cyclades_services, path, value, createpath=True)
......
......@@ -39,7 +39,7 @@ pithos_services = {
'prefix': 'object-store',
'public': True,
'endpoints': [
{'version': 'v1',
{'versionId': 'v1',
'publicURL': None},
]},
......@@ -49,7 +49,7 @@ pithos_services = {
'prefix': 'public',
'public': True,
'endpoints': [
{'version': 'v2.0',
{'versionId': 'v2.0',
'publicURL': None},
]},
......@@ -59,7 +59,7 @@ pithos_services = {
'prefix': 'ui',
'public': True,
'endpoints': [
{'version': '',
{'versionId': '',
'publicURL': None},
]},
}
......@@ -3,7 +3,9 @@ from django.conf import settings
from synnefo.lib import parse_base_url
from astakosclient import astakos_services
from synnefo.util.keypath import get_path
from pithos.api.services import pithos_services
from pithos.api.services import pithos_services as vanilla_pithos_services
from copy import deepcopy
# Top-level URL for Pithos. Must set.
BASE_URL = getattr(settings, 'PITHOS_BASE_URL',
......
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