Browse Source

Parse cli args in get_enforcer

Previously this call to the conf object couldn't parse cli args
because the oslo.policy tool was registering its cli opts on a
private conf object, so attempting to parse them on the global
object would fail. The dependency makes oslo.policy use the global
object instead so cli arg parsing works correctly.

This is important because ignoring cli args as this was previously
doing caused things like --config-file to be dropped, which meant
that running the tool with that option specified did not work as
expected.

Depends-On: https://review.opendev.org/690628
Change-Id: Id553743277a35660a40d6b3b02847d7a35abbfb9
Closes-Bug: 1849518
changes/30/690630/3
Ben Nemec 2 years ago
parent
commit
ba8dd06e12
  1. 7
      keystone/common/rbac_enforcer/policy.py
  2. 2
      lower-constraints.txt
  3. 2
      requirements.txt

7
keystone/common/rbac_enforcer/policy.py

@ -35,12 +35,7 @@ def get_enforcer():
:returns: :class:`oslo_policy.policy.Enforcer`
"""
# Here we pass an empty list of arguments because there aren't any
# arguments that oslo.config or oslo.policy shouldn't already understand
# from the CONF object. This makes things easier here because we don't have
# to parse arguments passed in from the command line and remove unexpected
# arguments before building a Config object.
CONF([], project='keystone')
CONF(project='keystone')
return _ENFORCER._enforcer

2
lower-constraints.txt

@ -34,7 +34,7 @@ oslo.i18n==3.15.3
oslo.log==3.44.0
oslo.messaging==5.29.0
oslo.middleware==3.31.0
oslo.policy==2.3.0
oslo.policy==3.0.2
oslo.serialization==2.18.0
oslo.upgradecheck==0.1.0
oslo.utils==3.33.0

2
requirements.txt

@ -27,7 +27,7 @@ oslo.db>=4.27.0 # Apache-2.0
oslo.i18n>=3.15.3 # Apache-2.0
oslo.log>=3.44.0 # Apache-2.0
oslo.middleware>=3.31.0 # Apache-2.0
oslo.policy>=2.3.0 # Apache-2.0
oslo.policy>=3.0.2 # Apache-2.0
oslo.serialization!=2.19.1,>=2.18.0 # Apache-2.0
oslo.upgradecheck>=0.1.0 # Apache-2.0
oslo.utils>=3.33.0 # Apache-2.0

Loading…
Cancel
Save