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)
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
Notes
Notes (review): Code-Review+2: ayoung <ayoung@redhat.com> Code-Review+2: Lance Bragstad <lbragstad@gmail.com> Code-Review+2: Colleen Murphy <colleen@gazlene.net> Workflow+1: Colleen Murphy <colleen@gazlene.net> Code-Review+1: yatin <ykarel@redhat.com> Verified+2: Zuul Submitted-by: Zuul Submitted-at: Fri, 07 Sep 2018 06:22:13 +0000 Reviewed-on: https://review.openstack.org/599936 Project: openstack/keystonemiddleware Branch: refs/heads/master
-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):
548 _base.AUTHTOKEN_GROUP, 548 _base.AUTHTOKEN_GROUP,
549 list_opts(), 549 list_opts(),
550 conf) 550 conf)
551 if self._conf.oslo_conf_obj != cfg.CONF: 551 if self._conf.oslo_conf_obj is not cfg.CONF:
552 oslo_cache.configure(self._conf.oslo_conf_obj) 552 oslo_cache.configure(self._conf.oslo_conf_obj)
553 553
554 token_roles_required = self._conf.get('service_token_roles_required') 554 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):
60 'password': uuid.uuid4().hex, 60 'password': uuid.uuid4().hex,
61 } 61 }
62 62
63 content = ("[keystone_authtoken]\n" 63 content = ("[DEFAULT]\n"
64 "test_opt=15\n"
65 "[keystone_authtoken]\n"
64 "auth_type=%(auth_type)s\n" 66 "auth_type=%(auth_type)s\n"
65 "www_authenticate_uri=%(www_authenticate_uri)s\n" 67 "www_authenticate_uri=%(www_authenticate_uri)s\n"
66 "auth_url=%(www_authenticate_uri)s\n" 68 "auth_url=%(www_authenticate_uri)s\n"
@@ -99,6 +101,16 @@ class TestAuthPluginLocalOsloConfig(base.BaseAuthTokenTestCase):
99 self.assertEqual(self.oslo_options[option], 101 self.assertEqual(self.oslo_options[option],
100 conf_get(app, option)) 102 conf_get(app, option))
101 103
104 def test_passed_oslo_configuration_with_deprecated_ones(self):
105 deprecated_opt = cfg.IntOpt('test_opt', deprecated_for_removal=True)
106 cfg.CONF.register_opt(deprecated_opt)
107 cfg.CONF(args=[],
108 default_config_files=[self.conf_file_fixture.path])
109 conf = {'oslo_config_config': cfg.CONF}
110
111 # success to init AuthProtocol
112 self._create_app(conf)
113
102 def test_passed_oslo_configuration_wins(self): 114 def test_passed_oslo_configuration_wins(self):
103 """oslo_config_config has precedence over oslo_config_project.""" 115 """oslo_config_config has precedence over oslo_config_project."""
104 conf = {'oslo_config_project': self.project, 116 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 @@
1---
2fixes:
3 - >
4 [`bug 1789351 <https://bugs.launchpad.net/keystonemiddleware/+bug/1789351>`_]
5 Fixed the bug that when initialize `AuthProtocol`, it'll raise "dictionary
6 changed size during iteration" error if the input `CONF` object contains
7 deprecated options.