Revision 74c62d99
b/snf-cyclades-app/synnefo/cyclades_settings.py | ||
---|---|---|
31 | 31 |
# interpreted as representing official policies, either expressed |
32 | 32 |
# or implied, of GRNET S.A. |
33 | 33 |
|
34 |
import logging |
|
35 |
|
|
34 | 36 |
from django.conf import settings |
35 | 37 |
from synnefo.lib import join_urls, parse_base_url |
36 | 38 |
from synnefo.util.keypath import get_path, set_path |
... | ... | |
41 | 43 |
from copy import deepcopy |
42 | 44 |
|
43 | 45 |
|
46 |
logger = logging.getLogger(__name__) |
|
47 |
|
|
44 | 48 |
# -------------------------------------------------------------------- |
45 | 49 |
# Process Cyclades settings |
46 | 50 |
|
... | ... | |
77 | 81 |
|
78 | 82 |
# -------------------------------------- |
79 | 83 |
# Define a LazyAstakosUrl |
84 |
# This is used to define ASTAKOS_ACCOUNT_URL and |
|
85 |
# ASTAKOS_UI_URL and should never be used as is. |
|
80 | 86 |
class LazyAstakosUrl(object): |
81 | 87 |
def __init__(self, endpoints_name): |
82 | 88 |
self.endpoints_name = endpoints_name |
... | ... | |
87 | 93 |
astakos_client = \ |
88 | 94 |
AstakosClient(SERVICE_TOKEN, ASTAKOS_AUTH_URL) |
89 | 95 |
self.str = getattr(astakos_client, self.endpoints_name) |
90 |
except: |
|
91 |
return None |
|
96 |
except Exception as excpt: |
|
97 |
logger.exception( |
|
98 |
"Could not retrieve endpoints from Astakos url %s: %s", |
|
99 |
ASTAKOS_AUTH_URL, excpt) |
|
100 |
return "" |
|
92 | 101 |
return self.str |
93 | 102 |
|
94 | 103 |
# -------------------------------------- |
95 | 104 |
# Define ASTAKOS_UI_URL and ASTAKOS_ACCOUNT_URL as LazyAstakosUrl |
105 |
# These are used to define the proxy paths. |
|
106 |
# These have to be resolved lazily (by the proxy function) so |
|
107 |
# they should not be used as is. |
|
96 | 108 |
ASTAKOS_ACCOUNT_URL = LazyAstakosUrl('account_url') |
97 | 109 |
ASTAKOS_UI_URL = LazyAstakosUrl('ui_url') |
98 | 110 |
|
b/snf-pithos-app/pithos/api/settings.py | ||
---|---|---|
32 | 32 |
# or implied, of GRNET S.A. |
33 | 33 |
|
34 | 34 |
#coding=utf8 |
35 |
import logging |
|
36 |
|
|
35 | 37 |
from django.conf import settings |
36 | 38 |
from synnefo.lib import parse_base_url, join_urls |
37 | 39 |
from synnefo.lib.services import fill_endpoints |
... | ... | |
42 | 44 |
from copy import deepcopy |
43 | 45 |
|
44 | 46 |
|
47 |
logger = logging.getLogger(__name__) |
|
48 |
|
|
45 | 49 |
# -------------------------------------------------------------------- |
46 | 50 |
# Process Pithos settings |
47 | 51 |
|
... | ... | |
74 | 78 |
|
75 | 79 |
# -------------------------------------- |
76 | 80 |
# Define a LazyAstakosUrl |
81 |
# This is used to define ASTAKOS_ACCOUNT_URL and |
|
82 |
# ASTAKOS_UI_URL and should never be used as is. |
|
77 | 83 |
class LazyAstakosUrl(object): |
78 | 84 |
def __init__(self, endpoints_name): |
79 | 85 |
self.endpoints_name = endpoints_name |
... | ... | |
84 | 90 |
astakos_client = \ |
85 | 91 |
AstakosClient(SERVICE_TOKEN, ASTAKOS_AUTH_URL) |
86 | 92 |
self.str = getattr(astakos_client, self.endpoints_name) |
87 |
except: |
|
88 |
return None |
|
93 |
except Exception as excpt: |
|
94 |
logger.exception( |
|
95 |
"Could not retrieve endpoints from Astakos url %s: %s", |
|
96 |
ASTAKOS_AUTH_URL, excpt) |
|
97 |
return "" |
|
89 | 98 |
return self.str |
90 | 99 |
|
91 | 100 |
# -------------------------------------- |
92 | 101 |
# Define ASTAKOS_ACCOUNT_URL and ASTAKOS_UR_URL as LazyAstakosUrl |
102 |
# These are used to define the proxy paths. |
|
103 |
# These have to be resolved lazily (by the proxy function) so |
|
104 |
# they should not be used as is. |
|
93 | 105 |
ASTAKOS_ACCOUNT_URL = LazyAstakosUrl('account_url') |
94 | 106 |
ASTAKOS_UI_URL = LazyAstakosUrl('ui_url') |
95 | 107 |
|
Also available in: Unified diff