Revision 7877e6d3

b/ci/tests.sh
16 16
    fi
17 17
}
18 18

  
19
export SYNNEFO_RELAX_MANDATORY_SETTINGS=1
20
export ASTAKOS_BASE_URL='https://astakos.example.synnefo.org/accounts'
21
export CYCLADES_BASE_URL='https://cyclades.example.synnefo.org/compute'
22
export PITHOS_BASE_URL='https://pithos.example.synnefo.org/object-store'
19 23
export SYNNEFO_SETTINGS_DIR=/etc/synnefo-test-settings
20 24

  
21 25
ASTAKOS_APPS="im quotaholder_app"
b/snf-common/synnefo/settings/setup/__init__.py
52 52
    def __init__(self, default_value, example=None, description=None):
53 53
        self.default_value = default_value
54 54
        if example is None:
55
            example_value = default_value
55
            example = default_value
56 56
        self.example_value = example
57 57
        self.description = description
58 58

  
......
100 100
    configured = {}
101 101
    defaults = settings._DEFAULTS
102 102
    failed = []
103
    import os
104
    relax_mandatory = bool(os.environ.get('SYNNEFO_RELAX_MANDATORY_SETTINGS'))
103 105

  
104 106
    for name, value in get_all_settings(settings):
105 107
        if isinstance(value, Example):
106
            m = ("Setting '{name}' is mandatory. "
107
                 "Please provide a real value. "
108
                 "Example value: '{example}'")
109
            m = m.format(name=name, example=value.example_value)
110
            failed.append(m)
108
            if relax_mandatory:
109
                setattr(settings, name, value.example_value)
110
            else:
111
                m = ("Setting '{name}' is mandatory. "
112
                     "Please provide a real value. "
113
                     "Example value: '{example}'")
114
                m = m.format(name=name, example=value.example_value)
115
                failed.append(m)
111 116
        elif isinstance(value, Default):
112 117
            m = "unprocessed default setting in post processing"
113 118
            raise AssertionError(m)
b/snf-common/synnefo/settings/setup/services.py
57 57

  
58 58

  
59 59
def setup_base_urls(settings):
60
    import os
60 61
    for component_name in settings.SYNNEFO_COMPONENTS.keys():
61 62
        name_upper = component_name.upper()
62 63
        base_url_name = name_upper + '_BASE_URL'
......
64 65
        base_path_name = name_upper + '_BASE_PATH'
65 66
        base_url = getattr(settings, base_url_name, None)
66 67
        if base_url is None:
67
            m = ("No '{setting_name}' setting found even though "
68
                 "component '{component_name}' is installed!\n")
69
            m = m.format(setting_name=base_url_name,
70
                         component_name=component_name)
71
            raise AssertionError(m)
68
            # try environment variable
69
            base_url = os.environ.get(base_url_name)
70
            if base_url is None:
71
                # give up
72
                m = ("No '{setting_name}' setting found even though "
73
                     "component '{component_name}' is installed!\n")
74
                m = m.format(setting_name=base_url_name,
75
                             component_name=component_name)
76
                raise AssertionError(m)
77
            else:
78
                setattr(settings, base_url_name, base_url)
72 79

  
73 80
        base_host, base_path = parse_base_url(base_url)
74 81
        setattr(settings, base_host_name, base_host)
b/snf-cyclades-app/synnefo/app_settings/default/api.py
3 3
# API configuration
4 4
#####################
5 5

  
6
from synnefo.settings.setup import Example
6 7

  
7 8
DEBUG = False
8 9

  
......
18 19
# network of this list. If the special network ID "SNF:ANY_PUBLIC" is used,
19 20
# Cyclades will automatically choose a public network and connect the server to
20 21
# it.
21
DEFAULT_INSTANCE_NETWORKS=["SNF:ANY_PUBLIC"]
22
DEFAULT_INSTANCE_NETWORKS = ["SNF:ANY_PUBLIC"]
22 23

  
23 24
# Maximum allowed network size for private networks.
24 25
MAX_CIDR_BLOCK = 22
......
80 81
MAX_PERSONALITY_SIZE = 10240
81 82

  
82 83

  
84
CYCLADES_BASE_URL = Example('https://cyclades.example.synnefo.org/compute')
83 85
# Top-level URL of the astakos instance to be used for user management
84
ASTAKOS_BASE_URL = 'https://accounts.example.synnefo.org/'
86
ASTAKOS_BASE_URL = Example('https://astakos.example.synnefo.org/accounts')
85 87

  
86 88
# Tune the size of the Astakos http client connection pool
87 89
# This limit the number of concurrent requests to Astakos.

Also available in: Unified diff