Revision 74c62d99 snf-cyclades-app/synnefo/cyclades_settings.py

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

  

Also available in: Unified diff