Revision 74c62d99 snf-pithos-app/pithos/api/settings.py

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