Statistics
| Branch: | Tag: | Revision:

root / snf-cyclades-app / synnefo / cyclades_settings.py @ 6e9255ab

History | View | Annotate | Download (4.1 kB)

1 e3ff6830 Georgios D. Tsoukalas
# Copyright 2013 GRNET S.A. All rights reserved.
2 e3ff6830 Georgios D. Tsoukalas
#
3 e3ff6830 Georgios D. Tsoukalas
# Redistribution and use in source and binary forms, with or
4 e3ff6830 Georgios D. Tsoukalas
# without modification, are permitted provided that the following
5 e3ff6830 Georgios D. Tsoukalas
# conditions are met:
6 e3ff6830 Georgios D. Tsoukalas
#
7 e3ff6830 Georgios D. Tsoukalas
#   1. Redistributions of source code must retain the above
8 e3ff6830 Georgios D. Tsoukalas
#      copyright notice, this list of conditions and the following
9 e3ff6830 Georgios D. Tsoukalas
#      disclaimer.
10 e3ff6830 Georgios D. Tsoukalas
#
11 e3ff6830 Georgios D. Tsoukalas
#   2. Redistributions in binary form must reproduce the above
12 e3ff6830 Georgios D. Tsoukalas
#      copyright notice, this list of conditions and the following
13 e3ff6830 Georgios D. Tsoukalas
#      disclaimer in the documentation and/or other materials
14 e3ff6830 Georgios D. Tsoukalas
#      provided with the distribution.
15 e3ff6830 Georgios D. Tsoukalas
#
16 e3ff6830 Georgios D. Tsoukalas
# THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
17 e3ff6830 Georgios D. Tsoukalas
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 e3ff6830 Georgios D. Tsoukalas
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19 e3ff6830 Georgios D. Tsoukalas
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
20 e3ff6830 Georgios D. Tsoukalas
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 e3ff6830 Georgios D. Tsoukalas
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 e3ff6830 Georgios D. Tsoukalas
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
23 e3ff6830 Georgios D. Tsoukalas
# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
24 e3ff6830 Georgios D. Tsoukalas
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 e3ff6830 Georgios D. Tsoukalas
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
26 e3ff6830 Georgios D. Tsoukalas
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27 e3ff6830 Georgios D. Tsoukalas
# POSSIBILITY OF SUCH DAMAGE.
28 e3ff6830 Georgios D. Tsoukalas
#
29 e3ff6830 Georgios D. Tsoukalas
# The views and conclusions contained in the software and
30 e3ff6830 Georgios D. Tsoukalas
# documentation are those of the authors and should not be
31 e3ff6830 Georgios D. Tsoukalas
# interpreted as representing official policies, either expressed
32 e3ff6830 Georgios D. Tsoukalas
# or implied, of GRNET S.A.
33 e3ff6830 Georgios D. Tsoukalas
34 e3ff6830 Georgios D. Tsoukalas
from django.conf import settings
35 e3ff6830 Georgios D. Tsoukalas
from synnefo.lib import join_urls, parse_base_url
36 4d6a9408 Kostas Papadimitriou
from synnefo.util.keypath import get_path, set_path
37 3ab15f84 Georgios D. Tsoukalas
from synnefo.api.services import cyclades_services as vanilla_cyclades_services
38 4080a1df Georgios D. Tsoukalas
from synnefo.lib.services import fill_endpoints
39 1691312c Kostas Papadimitriou
from astakosclient import astakos_services as vanilla_astakos_services
40 3ab15f84 Georgios D. Tsoukalas
41 3ab15f84 Georgios D. Tsoukalas
from copy import deepcopy
42 e3ff6830 Georgios D. Tsoukalas
43 00d2a0ee Georgios D. Tsoukalas
44 00d2a0ee Georgios D. Tsoukalas
# Process Cyclades settings
45 00d2a0ee Georgios D. Tsoukalas
46 e3ff6830 Georgios D. Tsoukalas
BASE_URL = getattr(settings, 'CYCLADES_BASE_URL',
47 e3ff6830 Georgios D. Tsoukalas
                   'https://compute.example.synnefo.org/compute/')
48 e3ff6830 Georgios D. Tsoukalas
BASE_HOST, BASE_PATH = parse_base_url(BASE_URL)
49 e3ff6830 Georgios D. Tsoukalas
50 3ab15f84 Georgios D. Tsoukalas
CUSTOMIZE_SERVICES = getattr(settings, 'CYCLADES_CUSTOMIZE_SERVICES', ())
51 3ab15f84 Georgios D. Tsoukalas
cyclades_services = deepcopy(vanilla_cyclades_services)
52 4080a1df Georgios D. Tsoukalas
fill_endpoints(cyclades_services, BASE_URL)
53 3ab15f84 Georgios D. Tsoukalas
for path, value in CUSTOMIZE_SERVICES:
54 3ab15f84 Georgios D. Tsoukalas
    set_path(cyclades_services, path, value, createpath=True)
55 3ab15f84 Georgios D. Tsoukalas
56 3ab15f84 Georgios D. Tsoukalas
COMPUTE_PREFIX = get_path(cyclades_services, 'cyclades_compute.prefix')
57 3ab15f84 Georgios D. Tsoukalas
VMAPI_PREFIX = get_path(cyclades_services, 'cyclades_vmapi.prefix')
58 3ab15f84 Georgios D. Tsoukalas
PLANKTON_PREFIX = get_path(cyclades_services, 'cyclades_plankton.prefix')
59 3ab15f84 Georgios D. Tsoukalas
HELPDESK_PREFIX = get_path(cyclades_services, 'cyclades_helpdesk.prefix')
60 3ab15f84 Georgios D. Tsoukalas
UI_PREFIX = get_path(cyclades_services, 'cyclades_ui.prefix')
61 3ab15f84 Georgios D. Tsoukalas
USERDATA_PREFIX = get_path(cyclades_services, 'cyclades_userdata.prefix')
62 4a8667dc Christos Stavrakakis
ADMIN_PREFIX = get_path(cyclades_services, 'cyclades_admin.prefix')
63 3ab15f84 Georgios D. Tsoukalas
64 00d2a0ee Georgios D. Tsoukalas
COMPUTE_ROOT_URL = join_urls(BASE_URL, COMPUTE_PREFIX)
65 00d2a0ee Georgios D. Tsoukalas
66 00d2a0ee Georgios D. Tsoukalas
67 00d2a0ee Georgios D. Tsoukalas
# Process Astakos settings
68 00d2a0ee Georgios D. Tsoukalas
69 00d2a0ee Georgios D. Tsoukalas
ASTAKOS_BASE_URL = getattr(settings, 'ASTAKOS_BASE_URL',
70 00d2a0ee Georgios D. Tsoukalas
                           'https://accounts.example.synnefo.org/astakos/')
71 00d2a0ee Georgios D. Tsoukalas
ASTAKOS_BASE_HOST, ASTAKOS_BASE_PATH = parse_base_url(ASTAKOS_BASE_URL)
72 00d2a0ee Georgios D. Tsoukalas
73 00d2a0ee Georgios D. Tsoukalas
# Patch astakosclient directly, otherwise it will not see any customization
74 00d2a0ee Georgios D. Tsoukalas
#astakos_services = deepcopy(vanilla_astakos_services)
75 00d2a0ee Georgios D. Tsoukalas
CUSTOMIZE_ASTAKOS_SERVICES = \
76 32e4e343 Christos Stavrakakis
    getattr(settings, 'CYCLADES_CUSTOMIZE_ASTAKOS_SERVICES', ())
77 1691312c Kostas Papadimitriou
78 1691312c Kostas Papadimitriou
astakos_services = deepcopy(vanilla_astakos_services)
79 1691312c Kostas Papadimitriou
fill_endpoints(astakos_services, ASTAKOS_BASE_URL)
80 00d2a0ee Georgios D. Tsoukalas
for path, value in CUSTOMIZE_ASTAKOS_SERVICES:
81 00d2a0ee Georgios D. Tsoukalas
    set_path(astakos_services, path, value, createpath=True)
82 00d2a0ee Georgios D. Tsoukalas
83 3ab15f84 Georgios D. Tsoukalas
ASTAKOS_ACCOUNTS_PREFIX = get_path(astakos_services, 'astakos_account.prefix')
84 3ab15f84 Georgios D. Tsoukalas
ASTAKOS_VIEWS_PREFIX = get_path(astakos_services, 'astakos_ui.prefix')
85 923e6582 Georgios D. Tsoukalas
ASTAKOS_KEYSTONE_PREFIX = get_path(astakos_services, 'astakos_identity.prefix')
86 e3ff6830 Georgios D. Tsoukalas
87 00d2a0ee Georgios D. Tsoukalas
88 00d2a0ee Georgios D. Tsoukalas
# Proxy Astakos settings
89 e3ff6830 Georgios D. Tsoukalas
90 e3ff6830 Georgios D. Tsoukalas
BASE_ASTAKOS_PROXY_PATH = getattr(settings,
91 e3ff6830 Georgios D. Tsoukalas
                                  'CYCLADES_BASE_ASTAKOS_PROXY_PATH',
92 e3ff6830 Georgios D. Tsoukalas
                                  ASTAKOS_BASE_PATH)
93 e3ff6830 Georgios D. Tsoukalas
BASE_ASTAKOS_PROXY_PATH = join_urls(BASE_PATH, BASE_ASTAKOS_PROXY_PATH)
94 e3ff6830 Georgios D. Tsoukalas
BASE_ASTAKOS_PROXY_PATH = BASE_ASTAKOS_PROXY_PATH.strip('/')
95 e3ff6830 Georgios D. Tsoukalas
96 e3ff6830 Georgios D. Tsoukalas
PROXY_USER_SERVICES = getattr(settings, 'CYCLADES_PROXY_USER_SERVICES', True)