Allow to configure policy_dirs

This patch makes it possible to override the current service default,
which is /etc/<service>/policy.d .

Change-Id: I738e0154fe1b84d2deb0a55f3b8672e5733762f6
This commit is contained in:
Thomas Goirand 2021-04-11 23:41:35 +02:00
parent d8d3d0656d
commit ceb3d30088
3 changed files with 14 additions and 1 deletions

View File

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

@ -0,0 +1,5 @@
---
features:
- |
There is now a new policy_dirs parameter in the mistral::policy class,
so one can set a custom path.

View File

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