From 7e897e574b8cbdfa8ee7cec15a04b2f44a9c311f Mon Sep 17 00:00:00 2001 From: Thomas Goirand Date: Thu, 1 Apr 2021 22:40:14 +0200 Subject: [PATCH] Allow to configure policy_dirs This patch makes it possible to override the current service default, which is /etc//policy.d . Change-Id: I134c7a13320f8a5770e738579d979f44092263b9 --- manifests/policy.pp | 8 +++++++- releasenotes/notes/policy-dirs-9addb26cee0b0a4d.yaml | 5 +++++ spec/classes/cinder_policy_spec.rb | 2 ++ 3 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 releasenotes/notes/policy-dirs-9addb26cee0b0a4d.yaml diff --git a/manifests/policy.pp b/manifests/policy.pp index 54356c23..1f2cd130 100644 --- a/manifests/policy.pp +++ b/manifests/policy.pp @@ -32,11 +32,16 @@ # (Optional) Path to the cinder policy.yaml file # Defaults to /etc/cinder/policy.yaml # +# [*policy_dirs*] +# (Optional) Path to the cinder policy folder +# Defaults to $::os_service_default +# class cinder::policy ( $enforce_scope = $::os_service_default, $enforce_new_defaults = $::os_service_default, $policies = {}, $policy_path = '/etc/cinder/policy.yaml', + $policy_dirs = $::os_service_default, ) { include cinder::deps @@ -56,7 +61,8 @@ class cinder::policy ( oslo::policy { 'cinder_config': enforce_scope => $enforce_scope, enforce_new_defaults => $enforce_new_defaults, - policy_file => $policy_path + policy_file => $policy_path, + policy_dirs => $policy_dirs, } } diff --git a/releasenotes/notes/policy-dirs-9addb26cee0b0a4d.yaml b/releasenotes/notes/policy-dirs-9addb26cee0b0a4d.yaml new file mode 100644 index 00000000..24a59c24 --- /dev/null +++ b/releasenotes/notes/policy-dirs-9addb26cee0b0a4d.yaml @@ -0,0 +1,5 @@ +--- +features: + - | + There is now a new policy_dirs parameter in the cinder::policy class, + so one can set a custom path. diff --git a/spec/classes/cinder_policy_spec.rb b/spec/classes/cinder_policy_spec.rb index a6d7707b..aebd2f07 100644 --- a/spec/classes/cinder_policy_spec.rb +++ b/spec/classes/cinder_policy_spec.rb @@ -7,6 +7,7 @@ describe 'cinder::policy' do :enforce_scope => false, :enforce_new_defaults => false, :policy_path => '/etc/cinder/policy.yaml', + :policy_dirs => '/etc/cinder/policy.d', :policies => { 'context_is_admin' => { 'key' => 'context_is_admin', @@ -28,6 +29,7 @@ describe 'cinder::policy' do :enforce_scope => false, :enforce_new_defaults => false, :policy_file => '/etc/cinder/policy.yaml', + :policy_dirs => '/etc/cinder/policy.d', ) end end