summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwangxiyuan <wangxiyuan@huawei.com>2018-09-05 10:21:51 +0800
committerwangxiyuan <wangxiyuan@huawei.com>2018-09-07 10:38:14 +0800
commit4fb7fef1eab2a981b8e366091073b6ee2d80ee6a (patch)
tree0cfb0c30b3d5b21c24bad34e6381a154f3e7e91e
parent2803f49cb1488d1504fd63711fd84dd14310184d (diff)
downloadkeystonemiddleware-4fb7fef1eab2a981b8e366091073b6ee2d80ee6a.tar.gz
No need to compare CONF content
When setup AuthProtocol class, if the CONF object contains deprecated options, An Error "dictionary changed size during iteration" will raise when comparing the CONF content. Changing "!=" to "is not" here to avoid compare the CONF content anymore. Change-Id: I820aa244160db4f81149d2576386c86b46de0084 Closes-bug: #1789351
-rw-r--r--keystonemiddleware/auth_token/__init__.py2
-rw-r--r--keystonemiddleware/tests/unit/auth_token/test_config.py14
-rw-r--r--releasenotes/notes/bug-1789351-102e2e5119be38b4.yaml7
3 files changed, 21 insertions, 2 deletions
diff --git a/keystonemiddleware/auth_token/__init__.py b/keystonemiddleware/auth_token/__init__.py
index 46a6b1e..4ac7388 100644
--- a/keystonemiddleware/auth_token/__init__.py
+++ b/keystonemiddleware/auth_token/__init__.py
@@ -548,7 +548,7 @@ class AuthProtocol(BaseAuthProtocol):
_base.AUTHTOKEN_GROUP,
list_opts(),
conf)
- if self._conf.oslo_conf_obj != cfg.CONF:
+ if self._conf.oslo_conf_obj is not cfg.CONF:
oslo_cache.configure(self._conf.oslo_conf_obj)
token_roles_required = self._conf.get('service_token_roles_required')
diff --git a/keystonemiddleware/tests/unit/auth_token/test_config.py b/keystonemiddleware/tests/unit/auth_token/test_config.py
index 6b824af..6a253a1 100644
--- a/keystonemiddleware/tests/unit/auth_token/test_config.py
+++ b/keystonemiddleware/tests/unit/auth_token/test_config.py
@@ -60,7 +60,9 @@ class TestAuthPluginLocalOsloConfig(base.BaseAuthTokenTestCase):
'password': uuid.uuid4().hex,
}
- content = ("[keystone_authtoken]\n"
+ content = ("[DEFAULT]\n"
+ "test_opt=15\n"
+ "[keystone_authtoken]\n"
"auth_type=%(auth_type)s\n"
"www_authenticate_uri=%(www_authenticate_uri)s\n"
"auth_url=%(www_authenticate_uri)s\n"
@@ -99,6 +101,16 @@ class TestAuthPluginLocalOsloConfig(base.BaseAuthTokenTestCase):
self.assertEqual(self.oslo_options[option],
conf_get(app, option))
+ def test_passed_oslo_configuration_with_deprecated_ones(self):
+ deprecated_opt = cfg.IntOpt('test_opt', deprecated_for_removal=True)
+ cfg.CONF.register_opt(deprecated_opt)
+ cfg.CONF(args=[],
+ default_config_files=[self.conf_file_fixture.path])
+ conf = {'oslo_config_config': cfg.CONF}
+
+ # success to init AuthProtocol
+ self._create_app(conf)
+
def test_passed_oslo_configuration_wins(self):
"""oslo_config_config has precedence over oslo_config_project."""
conf = {'oslo_config_project': self.project,
diff --git a/releasenotes/notes/bug-1789351-102e2e5119be38b4.yaml b/releasenotes/notes/bug-1789351-102e2e5119be38b4.yaml
new file mode 100644
index 0000000..65f5555
--- /dev/null
+++ b/releasenotes/notes/bug-1789351-102e2e5119be38b4.yaml
@@ -0,0 +1,7 @@
+---
+fixes:
+ - >
+ [`bug 1789351 <https://bugs.launchpad.net/keystonemiddleware/+bug/1789351>`_]
+ Fixed the bug that when initialize `AuthProtocol`, it'll raise "dictionary
+ changed size during iteration" error if the input `CONF` object contains
+ deprecated options.