Merge "add a log when the option in conf can't be identitied"
This commit is contained in:
commit
1e06a64d4e
@ -13,6 +13,7 @@
|
|||||||
import pkg_resources
|
import pkg_resources
|
||||||
|
|
||||||
from oslo_config import cfg
|
from oslo_config import cfg
|
||||||
|
from oslo_log import log as logging
|
||||||
import pbr
|
import pbr
|
||||||
import six
|
import six
|
||||||
|
|
||||||
@ -21,6 +22,7 @@ from keystonemiddleware.i18n import _
|
|||||||
|
|
||||||
CONF = cfg.CONF
|
CONF = cfg.CONF
|
||||||
_NOT_SET = object()
|
_NOT_SET = object()
|
||||||
|
_LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
def _conf_values_type_convert(group_name, all_options, conf):
|
def _conf_values_type_convert(group_name, all_options, conf):
|
||||||
@ -53,8 +55,8 @@ def _conf_values_type_convert(group_name, all_options, conf):
|
|||||||
v = type_(v)
|
v = type_(v)
|
||||||
except KeyError: # nosec
|
except KeyError: # nosec
|
||||||
# This option is not known to auth_token. v is not converted.
|
# This option is not known to auth_token. v is not converted.
|
||||||
# FIXME(jamielennox): This should probably log a warning.
|
_LOG.warning(
|
||||||
pass
|
'The option "%s" in conf is not known to auth_token', k)
|
||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
raise exceptions.ConfigurationError(
|
raise exceptions.ConfigurationError(
|
||||||
_('Unable to convert the value of %(key)s option into correct '
|
_('Unable to convert the value of %(key)s option into correct '
|
||||||
|
@ -491,6 +491,14 @@ class GeneralAuthTokenMiddlewareTest(BaseAuthTokenMiddlewareTest,
|
|||||||
middleware = auth_token.AuthProtocol(self.fake_app, conf)
|
middleware = auth_token.AuthProtocol(self.fake_app, conf)
|
||||||
self.assertEqual([servers], middleware._conf.get('memcached_servers'))
|
self.assertEqual([servers], middleware._conf.get('memcached_servers'))
|
||||||
|
|
||||||
|
def test_conf_values_type_convert_with_wrong_key(self):
|
||||||
|
conf = {
|
||||||
|
'wrong_key': '123'
|
||||||
|
}
|
||||||
|
log = 'The option "wrong_key" in conf is not known to auth_token'
|
||||||
|
auth_token.AuthProtocol(self.fake_app, conf)
|
||||||
|
self.assertThat(self.logger.output, matchers.Contains(log))
|
||||||
|
|
||||||
def test_conf_values_type_convert_with_wrong_value(self):
|
def test_conf_values_type_convert_with_wrong_value(self):
|
||||||
conf = {
|
conf = {
|
||||||
'include_service_catalog': '123',
|
'include_service_catalog': '123',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user