« Previous | Next » 

Revision c2c4af89

IDc2c4af89c38b8ea80490cd5d03363ff294829795

Added by Georgios D. Tsoukalas almost 11 years ago

common: reconfigure the synnefo settings framework

- add 'services' endpoint in 'synnefo' namespace,
where all components register their services.

- add three stages of setting initialization:
1. preprocessing, after default settings are read from components,
and before any user configuration files are read.
2. postprocessing, after all user configuration files have been read.
3. setup, which runs a (configurable) list of setup modules on the
settings.

- add special default settings value classes:
- setting_name = Example("example value")
which makes 'setting_name' mandatory to be set by the user,
providing an example value for the error message if they don't.

- setting_name = Default("default value")
which makes the setting optional for the user settings,
but also makes synnefo settings "know" whether the user did
configure it themselves or just let it default.
- setting_name = Deprecated()
which makes the setting mandatory to NOT be set by the user,
to force them to remove it or replace it appropriately

- preprocessing scans settings for the special-value classes
and compiles the following dicts:

settings._DEPRECATED -> a dict with all Deprecated() settings
settings._MANDATORY -> a dict with all Example() settings
settings._DEFAULTS -> a dict with all Defaults() settings
settings._OTHER -> a dict with the rest of the settings

- postprocessing scans the settings after reading the user configuration
files, raises errors on mandatory and deprecated settings, and
compiles a settings._CONFIGURED dict with all default settings that
have been actually configured by the user.

- settings.SYNNEFO_SETTINGS_SETUP_MODULES is initialized as
['synnefo.settings.setup.services'].
At the setup stage, all modules within that list are imported
and their module.setup_settings(settings) function is run.

- services.setup_settings() configures:

- settings.SYNNEFO_SERVICES, a JSON-exportable document from all
documents contributed by installed synnefo components via the
'services' entry point.
- settings.SYNNEFO_COMPONENTS, a dict of component names to
their services catalog (dict), extracted from SYNNEFO_SERVICES.
- for each component name, it demands a settings.<COMPONENT>_BASE_URL
setting, making it a fatal error not to provide one.
After retrieving COMPONENT_BASE_URL, it also generates
settings.<COMPONENT>_BASE_HOST and settings.<COMPONENT>_BASE_PATH
- Using the base path settings, fills in the PublicURL entrypoints
for all services in SYNNEFO_SERVICES.

- add snf-manage settings command, to display various aspects of
settings, such as complete listing, defaults-only, configured-only,
etc.

Files

  • added
  • modified
  • copied
  • renamed
  • deleted

View differences