Add support for oslo_policy/policy_dirs

Change-Id: I9ddd46e3b6f2dc9abd36ad7e821e6598ab71689c
This commit is contained in:
Takashi Kajinami 2021-04-22 11:57:19 +09:00
parent 952503a3c2
commit f21b7007d0
2 changed files with 9 additions and 1 deletions

View File

@ -32,11 +32,16 @@
# (Optional) Path to the {{cookiecutter.project_name}} policy.yaml file
# Defaults to /etc/{{cookiecutter.project_name}}/policy.yaml
#
# [*policy_dirs*]
# (Optional) Path to the {{cookiecutter.project_name}} policy folder
# Defaults to $::os_service_default
#
class {{cookiecutter.project_name}}::policy (
$enforce_scope = $::os_service_default,
$enforce_new_defaults = $::os_service_default,
$policies = {},
$policy_path = '/etc/{{cookiecutter.project_name}}/policy.yaml',
$policy_dirs = $::os_service_default,
) {
include {{cookiecutter.project_name}}::deps
@ -56,7 +61,8 @@ class {{cookiecutter.project_name}}::policy (
oslo::policy { '{{cookiecutter.project_name}}_config':
enforce_scope => $enforce_scope,
enforce_new_defaults => $enforce_new_defaults,
policy_file => $policy_path
policy_file => $policy_path,
policy_dirs => $policy_dirs,
}
}

View File

@ -7,6 +7,7 @@ describe '{{cookiecutter.project_name}}::policy' do
:enforce_scope => false,
:enforce_new_defaults => false,
:policy_path => '/etc/{{cookiecutter.project_name}}/policy.yaml',
:policy_dirs => '/etc/{{cookiecutter.project_name}}/policy.d',
:policies => {
'context_is_admin' => {
'key' => 'context_is_admin',
@ -28,6 +29,7 @@ describe '{{cookiecutter.project_name}}::policy' do
:enforce_scope => false,
:enforce_new_defaults => false,
:policy_file => '/etc/{{cookiecutter.project_name}}/policy.yaml',
:policy_dirs => '/etc/{{cookiecutter.project_name}}/policy.d',
)
end
end