diff options
author | Abhishek Sharma <abmsharm@in.ibm.com> | 2017-10-26 01:30:54 -0500 |
---|---|---|
committer | Matthew Edmonds <edmondsw@us.ibm.com> | 2017-12-07 10:43:49 -0500 |
commit | 0c0eae3b1eb537159f26c82647fb61cc3de8536a (patch) | |
tree | 91ba474b24c1716dfad531b5b27701bfb342063c /keystonemiddleware | |
parent | db21ecd2b55578f9fecae29f9b1334ca5d60e28b (diff) | |
download | keystonemiddleware-0c0eae3b1eb537159f26c82647fb61cc3de8536a.tar.gz |
Expect paste.deploy and gnocchi/panko options
The authtoken middleware has been printing warning log messages to
the API logs for all services, reporting unexpected conf keys. This
was traced back to paste.deploy adding 'here' and '__file__' and
both gnocchi and panko adding 'configkey' keys in wsgi apps though
these do not actually exist in the conf file. This change allows
for those keys without printing a warning that unnecessarily
confuses operators.
But it's kind of a hack, especially the configkey bit. We shouldn't
have to know about gnocchi/panko specifics like this. And it doesn't
address the comment in the bug about what is seen for ironic. So I
think there will still be more to do here.
Change-Id: I678482309c7dd35ce147bebf13ebefc84251fe91
Partial-Bug: 1722444
Diffstat (limited to 'keystonemiddleware')
-rw-r--r-- | keystonemiddleware/_common/config.py | 11 | ||||
-rw-r--r-- | keystonemiddleware/tests/unit/auth_token/test_auth_token_middleware.py | 2 |
2 files changed, 7 insertions, 6 deletions
diff --git a/keystonemiddleware/_common/config.py b/keystonemiddleware/_common/config.py index 3e38eba..de701b0 100644 --- a/keystonemiddleware/_common/config.py +++ b/keystonemiddleware/_common/config.py @@ -49,17 +49,18 @@ def _conf_values_type_convert(group_name, all_options, conf): for k, v in conf.items(): dest = k try: - if v is not None: + # 'here' and '__file__' come from paste.deploy + # 'configkey' is added by panko and gnocchi + if v is not None and k not in ['here', '__file__', 'configkey']: type_, dest = opt_types[k] v = type_(v) except KeyError: # nosec - # This option is not known to auth_token. v is not converted. _LOG.warning( - 'The option "%s" in conf is not known to auth_token', k) + 'The option "%s" is not known to keystonemiddleware', k) except ValueError as e: raise exceptions.ConfigurationError( - _('Unable to convert the value of %(key)s option into correct ' - 'type: %(ex)s') % {'key': k, 'ex': e}) + _('Unable to convert the value of option "%(key)s" into ' + 'correct type: %(ex)s') % {'key': k, 'ex': e}) opts[dest] = v return opts diff --git a/keystonemiddleware/tests/unit/auth_token/test_auth_token_middleware.py b/keystonemiddleware/tests/unit/auth_token/test_auth_token_middleware.py index 5c59d14..130eae7 100644 --- a/keystonemiddleware/tests/unit/auth_token/test_auth_token_middleware.py +++ b/keystonemiddleware/tests/unit/auth_token/test_auth_token_middleware.py @@ -513,7 +513,7 @@ class GeneralAuthTokenMiddlewareTest(BaseAuthTokenMiddlewareTest, conf = { 'wrong_key': '123' } - log = 'The option "wrong_key" in conf is not known to auth_token' + log = 'The option "wrong_key" is not known to keystonemiddleware' auth_token.AuthProtocol(self.fake_app, conf) self.assertThat(self.logger.output, matchers.Contains(log)) |