def fill_endpoints(services, base_url): for name, service in services.iteritems(): prefix = get_path(service, 'prefix') endpoints = get_path(service, 'endpoints') 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).rstrip('/') + '/' set_path(endpoint, 'publicURL', publicURL)
from astakosclient import astakos_services as vanilla_astakos_services from copy import deepcopy # Process Cyclades settings BASE_URL = getattr(settings, 'CYCLADES_BASE_URL', 'https://compute.example.synnefo.org/compute/') 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) COMPUTE_PREFIX = get_path(cyclades_services, 'cyclades_compute.prefix') VMAPI_PREFIX = get_path(cyclades_services, 'cyclades_vmapi.prefix') PLANKTON_PREFIX = get_path(cyclades_services, 'cyclades_plankton.prefix') HELPDESK_PREFIX = get_path(cyclades_services, 'cyclades_helpdesk.prefix') UI_PREFIX = get_path(cyclades_services, 'cyclades_ui.prefix') USERDATA_PREFIX = get_path(cyclades_services, 'cyclades_userdata.prefix') ADMIN_PREFIX = get_path(cyclades_services, 'cyclades_admin.prefix') COMPUTE_ROOT_URL = join_urls(BASE_URL, COMPUTE_PREFIX) # Process Astakos settings ASTAKOS_BASE_URL = getattr(settings, 'ASTAKOS_BASE_URL',
logger = logging.getLogger(__name__) # -------------------------------------------------------------------- # Process Cyclades settings BASE_URL = getattr(settings, 'CYCLADES_BASE_URL', 'https://compute.example.synnefo.org/compute/') BASE_HOST, BASE_PATH = parse_base_url(BASE_URL) SERVICE_TOKEN = getattr(settings, 'CYCLADES_SERVICE_TOKEN', "") 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) COMPUTE_PREFIX = get_path(cyclades_services, 'cyclades_compute.prefix') NETWORK_PREFIX = get_path(cyclades_services, 'cyclades_network.prefix') VMAPI_PREFIX = get_path(cyclades_services, 'cyclades_vmapi.prefix') PLANKTON_PREFIX = get_path(cyclades_services, 'cyclades_plankton.prefix') HELPDESK_PREFIX = get_path(cyclades_services, 'cyclades_helpdesk.prefix') UI_PREFIX = get_path(cyclades_services, 'cyclades_ui.prefix') USERDATA_PREFIX = get_path(cyclades_services, 'cyclades_userdata.prefix') ADMIN_PREFIX = get_path(cyclades_services, 'cyclades_admin.prefix') COMPUTE_ROOT_URL = join_urls(BASE_URL, COMPUTE_PREFIX) # -------------------------------------------------------------------- # Process Astakos settings
ASTAKOS_BASE_URL = getattr(settings, 'ASTAKOS_BASE_URL', 'https://accounts.example.synnefo.org/astakos/') ASTAKOS_BASE_HOST, ASTAKOS_BASE_PATH = parse_base_url(ASTAKOS_BASE_URL) pithos_services = deepcopy(vanilla_pithos_services) fill_endpoints(pithos_services, BASE_URL) PITHOS_PREFIX = get_path(pithos_services, 'pithos_object-store.prefix') PUBLIC_PREFIX = get_path(pithos_services, 'pithos_public.prefix') UI_PREFIX = get_path(pithos_services, 'pithos_ui.prefix') astakos_services = deepcopy(vanilla_astakos_services) fill_endpoints(astakos_services, ASTAKOS_BASE_URL) CUSTOMIZE_ASTAKOS_SERVICES = \ getattr(settings, 'PITHOS_CUSTOMIZE_ASTAKOS_SERVICES', ()) for path, value in CUSTOMIZE_ASTAKOS_SERVICES: set_path(astakos_services, path, value, createpath=True) ASTAKOS_ACCOUNTS_PREFIX = get_path(astakos_services, 'astakos_account.prefix') ASTAKOS_VIEWS_PREFIX = get_path(astakos_services, 'astakos_ui.prefix') ASTAKOS_KEYSTONE_PREFIX = get_path(astakos_services, 'astakos_identity.prefix') BASE_ASTAKOS_PROXY_PATH = getattr(settings, 'PITHOS_BASE_ASTAKOS_PROXY_PATH', ASTAKOS_BASE_PATH) BASE_ASTAKOS_PROXY_PATH = join_urls(BASE_PATH, BASE_ASTAKOS_PROXY_PATH) BASE_ASTAKOS_PROXY_PATH = BASE_ASTAKOS_PROXY_PATH.strip('/') ASTAKOSCLIENT_POOLSIZE = getattr(settings, 'PITHOS_ASTAKOSCLIENT_POOLSIZE', 200) COOKIE_NAME = getattr(settings, 'PITHOS_ASTAKOS_COOKIE_NAME', '_pithos2_a')