Fix oslo policy file genrator tool for Magnum
oslo tool to generate the policy or sample policy file does not work for magnum service. ``oslopolicy-policy-generator --namespace magnum`` end up with below error: ModuleNotFoundError: No module named 'magnum.policy' same error with oslopolicy-sample-generator --namespace magnum oslo.policy policy generator tool look for the service oslo policy enforcer entry and does not find it. setup.cfg file is missing the entry point for magnum oslo policy enforcer. - https://lists.openstack.org/archives/list/openstack-discuss@lists.openstack.org/thread/5ZRWWL3YKWX3XCFGTC4G2KP6PCJMBL64/ Closes-Bug: #2068519 Change-Id: Iff94f7dea491b0ea465b17cd60c37423224f9ffa (cherry picked from commit8d09169a8a
) (cherry picked from commit2045ffb5cc
) (cherry picked from commitf3cfcfd8f1
)
This commit is contained in:
parent
30ab9c9f5c
commit
77293ee6c6
@ -119,6 +119,14 @@ def add_policy_attributes(target):
|
||||
return target
|
||||
|
||||
|
||||
def get_enforcer():
|
||||
# This method is used by oslopolicy CLI scripts in order to generate policy
|
||||
# files from overrides on disk and defaults in code.
|
||||
cfg.CONF([], project='magnum')
|
||||
init()
|
||||
return _ENFORCER
|
||||
|
||||
|
||||
def check_is_admin(context):
|
||||
"""Whether or not user is admin according to policy setting.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user