cfg.CONF must not be used directly

cfg.CONF must not be used directly, Config().oslo_conf_obj must be used
instead.

Closes-bug: #1737119

Change-Id: I58ec9e25c7f04a8352535d8861e09c7e4c4c0a9d
This commit is contained in:
Mehdi Abaakouk 2017-12-08 09:56:31 +01:00 committed by Mehdi Abaakouk (sileht)
parent a08bc44e04
commit 4531809d60
2 changed files with 9 additions and 2 deletions

View File

@ -559,6 +559,8 @@ class AuthProtocol(BaseAuthProtocol):
_base.AUTHTOKEN_GROUP,
list_opts(),
conf)
if self._conf.oslo_conf_obj != cfg.CONF:
oslo_cache.configure(self._conf.oslo_conf_obj)
token_roles_required = self._conf.get('service_token_roles_required')
@ -957,9 +959,8 @@ class AuthProtocol(BaseAuthProtocol):
def _create_oslo_cache(self):
# having this as a function makes test mocking easier
conf = cfg.CONF
region = oslo_cache.create_region()
oslo_cache.configure_cache_region(conf, region)
oslo_cache.configure_cache_region(self._conf.oslo_conf_obj, region)
return region
def _token_cache_factory(self):

View File

@ -0,0 +1,6 @@
---
fixes:
- >
[`bug 1737119 <https://bugs.launchpad.net/keystonemiddleware/+bug/1737119>`_]
If the application was not using the global cfg.CONF object, the configuration
was not read from the configuration file. This have been fixed.