Skip to content

Commit f102b74

Browse files
committed
Remove 'admin_role' option
This option was deprecated in the Ussuri release by change I0f61f85a0aaa4f68e345fa08fbb6b039d3d32587 and it is now eligible for removal following the standard OpenStack deprecation policy. Change-Id: I78ec79f97bfdcc39772448296140f8d8f35adea1
1 parent 1344c45 commit f102b74

File tree

5 files changed

+12
-64
lines changed

5 files changed

+12
-64
lines changed

doc/source/admin/authentication.rst

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,3 @@ configuration file, select the appropriate deployment flavor by adding a
114114

115115
[paste_deploy]
116116
flavor = keystone
117-
118-
.. note::
119-
If your authentication service uses a role other than ``admin`` to identify
120-
which users should be granted admin-level privileges, you must define it
121-
in the ``admin_role`` config attribute in both ``glance-registry.conf`` and
122-
``glance-api.conf``.

glance/api/middleware/context.py

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -54,41 +54,6 @@
5454
Related options:
5555
* None
5656
57-
""")),
58-
59-
cfg.StrOpt('admin_role',
60-
default=('__NOT_A_ROLE_07697c71e6174332989d3d5f2a7d2e7c'
61-
'_NOT_A_ROLE__'),
62-
deprecated_for_removal=True,
63-
deprecated_since="Ussuri",
64-
deprecated_reason=_("""
65-
This option is redundant as its goal can be achieved via policy file
66-
configuration. Additionally, it can override any configured policies,
67-
leading to unexpected behavior and difficulty in policy configuration.
68-
The option will be removed early in the Victoria development cycle,
69-
following the standard OpenStack deprecation policy.
70-
71-
Because this can be a security issue, the default value of this
72-
configuration option has been changed in this release.
73-
74-
Please see the 'Deprecation Notes' section of the Ussuri Glance
75-
Release Notes for more information.
76-
"""),
77-
help=_("""
78-
Role used to identify an authenticated user as administrator.
79-
80-
Provide a string value representing a Keystone role to identify an
81-
administrative user. Users with this role will be granted
82-
administrative privileges.
83-
84-
NOTE: The default value for this option has changed in this release.
85-
86-
Possible values:
87-
* A string value which is a valid Keystone role
88-
89-
Related options:
90-
* None
91-
9257
""")),
9358

9459
cfg.BoolOpt('allow_anonymous_access', default=False,
@@ -221,9 +186,6 @@ def _get_authenticated_context(self, req):
221186
# fixed.
222187
ctxt.roles = [r.lower() for r in ctxt.roles]
223188

224-
if CONF.admin_role.strip().lower() in ctxt.roles:
225-
ctxt.is_admin = True
226-
227189
return ctxt
228190

229191

glance/tests/functional/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -745,7 +745,6 @@ def __init__(self, test_dir, policy_file, daemon=False, **kwargs):
745745
self.policy_default_rule = 'default'
746746

747747
self.send_identity_headers = False
748-
self.admin_role = 'admin'
749748

750749
self.conf_base = """[DEFAULT]
751750
debug = %(debug)s

glance/tests/unit/test_context_middleware.py

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -56,36 +56,23 @@ def test_is_admin_flag(self):
5656
self._build_middleware().process_request(req)
5757
self.assertFalse(req.context.is_admin)
5858

59-
# if we change the admin_role attribute, we should be able to use it
60-
req = self._build_request()
61-
self.config(admin_role='role1')
62-
self._build_middleware().process_request(req)
63-
self.assertTrue(req.context.is_admin)
59+
# the admin_role config option was removed in Wallaby
60+
from oslo_config.cfg import NoSuchOptError
61+
self.assertRaises(NoSuchOptError,
62+
self.config,
63+
admin_role='role1')
6464

6565
def test_roles_case_insensitive(self):
6666
# accept role from request
6767
req = self._build_request(roles=['Admin', 'role2'])
6868
self._build_middleware().process_request(req)
6969
self.assertTrue(req.context.is_admin)
7070

71-
# accept role from config
72-
req = self._build_request(roles=['role1'])
73-
self.config(admin_role='rOLe1')
74-
self._build_middleware().process_request(req)
75-
self.assertTrue(req.context.is_admin)
76-
7771
def test_roles_stripping(self):
7872
# stripping extra spaces in request
7973
req = self._build_request(roles=['\trole1'])
80-
self.config(admin_role='role1')
8174
self._build_middleware().process_request(req)
82-
self.assertTrue(req.context.is_admin)
83-
84-
# stripping extra spaces in config
85-
req = self._build_request(roles=['\trole1\n'])
86-
self.config(admin_role=' role1\t')
87-
self._build_middleware().process_request(req)
88-
self.assertTrue(req.context.is_admin)
75+
self.assertIn('role1', req.context.roles)
8976

9077
def test_anonymous_access_enabled(self):
9178
req = self._build_request(identity_status='Nope')
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
upgrade:
3+
- |
4+
The Glance API configuration option ``admin_role``, having been deprecated
5+
in the Ussuri release, is now removed. If present in a configuration file,
6+
it will be silently ignored.

0 commit comments

Comments
 (0)