diff options
author | Alan Pevec <apevec@redhat.com> | 2013-03-09 01:58:33 +0100 |
---|---|---|
committer | Alan Pevec <apevec@redhat.com> | 2013-05-26 17:36:08 +0200 |
commit | 64738924b87e6fb31d999e25da23f889a2658940 (patch) | |
tree | ea3abedea6d1ad6c7bc72550129e5f21c7d8eee5 /keystone/config.py | |
parent | af4e96986f6ee45e9e4ccac0b143902362a1a676 (diff) | |
download | keystone-64738924b87e6fb31d999e25da23f889a2658940.tar.gz keystone-64738924b87e6fb31d999e25da23f889a2658940.tar.xz keystone-64738924b87e6fb31d999e25da23f889a2658940.zip |
separate paste-deploy configuration from parameters
PasteDeploy configuration contains class names which might change
between releases. Keeping it separate from user-configurable
parameters allows deployers to move paste-deploy ini file out of
configuration directory to a place where it can be safely overwritten
on updates e.g. under /usr/share/
DocImpact
Change-Id: I9292ca6226c8430b93565dedd45cc842742a23e2
Diffstat (limited to 'keystone/config.py')
-rw-r--r-- | keystone/config.py | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/keystone/config.py b/keystone/config.py index e2ff6f4e..28f1cf2c 100644 --- a/keystone/config.py +++ b/keystone/config.py @@ -15,7 +15,10 @@ # under the License. """Wrapper for keystone.common.config that configures itself on import.""" +import os + from keystone.common import config +from keystone import exception config.configure() @@ -31,3 +34,31 @@ register_cli_bool = config.register_cli_bool register_int = config.register_int register_cli_int = config.register_cli_int setup_authentication = config.setup_authentication + + +def find_paste_config(): + """Selects Keystone paste.deploy configuration file. + + Keystone paste.deploy configuration file is selectd in [paste_deploy] + section of the main Keystone configuration file. + For example: + [paste_deploy] + config_file = keystone-paste.ini + + :returns: The selected configuration filename + :raises: exception.PasteConfigNotFound + """ + if CONF.paste_deploy.config_file: + paste_config = CONF.paste_deploy.config_file + paste_config_value = paste_config + if not os.path.isabs(paste_config): + paste_config = CONF.find_file(paste_config) + elif CONF.config_file: + paste_config = CONF.config_file[0] + paste_config_value = paste_config + else: + paste_config = CONF.find_file('keystone.conf') + paste_config_value = 'keystone.conf' + if not paste_config or not os.path.exists(paste_config): + raise exception.PasteConfigNotFound(config_file=paste_config_value) + return paste_config |