Add configuration option for policy.json file path

For user authorizations, oslo_policy need to load the rules and policies defined in the policy.json file. When the oslo_policy
enforcer is initializing it will look for the path of this file in
cfg.CONF. Gluon needs to add this configuration option to its
configuration.

Change-Id: I248d5c00a7259bb62bacf20d3ea2975293500c5e
This commit is contained in:
JinLi 2017-07-07 15:02:24 -07:00
parent 0d9ad1373c
commit e1b0fdaad1
2 changed files with 31 additions and 1 deletions

View File

@ -322,6 +322,21 @@ state_path = /var/lib/proton
#auth_section = <None>
[oslo_policy]
#
# From gluon.conf
#
# File path to the policy_file. Gluon models define policies in their
# corresponding yaml files and in most cases users should manage policies e.g.
# create, update, and delete policies within the yaml files thus making the
# yaml files as the single reference for model definitions. This file is
# provided as an avaiable option for users to add new or modify existing
# policies. (string value)
#policy_file = /etc/proton/policy.json
[path]
#

View File

@ -59,14 +59,29 @@ SQL_OPTS = [
help='MySQL engine to use.'),
]
POLICY_OPTS = [
cfg.StrOpt('policy_file',
default='/etc/proton/policy.json',
help=("File path to the policy_file. Gluon models define "
"policies in their corresponding yaml files and in most "
"cases users should manage policies e.g. create, update, "
"and delete policies within the yaml files thus making "
"the yaml files as the single reference for model "
"definitions. This file is provided as an avaiable "
"option for users to add new or modify existing policies."
)),
]
def register_opts(conf):
conf.register_opts(API_OPTS, 'api')
conf.register_opts(PATH_OPTS)
conf.register_opts(SQL_OPTS, 'database')
conf.register_opts(POLICY_OPTS)
def list_opts():
return {'api': API_OPTS,
'path': PATH_OPTS,
'database': SQL_OPTS}
'database': SQL_OPTS,
'oslo_policy': POLICY_OPTS}