From 027f296e659657a9472b78733d7d321518dad861 Mon Sep 17 00:00:00 2001 From: Thomas Goirand Date: Thu, 1 Apr 2021 22:54:21 +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: I2942397fcf2e60dbf9f66d0bce289cd15c99ddba --- manifests/policy.pp | 8 +++++++- releasenotes/notes/policy-dirs-91b7945f046e8fab.yaml | 5 +++++ spec/classes/glance_policy_spec.rb | 2 ++ 3 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 releasenotes/notes/policy-dirs-91b7945f046e8fab.yaml diff --git a/manifests/policy.pp b/manifests/policy.pp index ae9e8d7a..ce749f4f 100644 --- a/manifests/policy.pp +++ b/manifests/policy.pp @@ -32,11 +32,16 @@ # (Optional) Path to the glance policy.yaml file # Defaults to /etc/glance/policy.yaml # +# [*policy_dirs*] +# (Optional) Path to the glance policy folder +# Defaults to $::os_service_default +# class glance::policy ( $enforce_scope = $::os_service_default, $enforce_new_defaults = $::os_service_default, $policies = {}, $policy_path = '/etc/glance/policy.yaml', + $policy_dirs = $::os_service_default, ) { include glance::deps @@ -56,7 +61,8 @@ class glance::policy ( oslo::policy { 'glance_api_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-91b7945f046e8fab.yaml b/releasenotes/notes/policy-dirs-91b7945f046e8fab.yaml new file mode 100644 index 00000000..5ea759ab --- /dev/null +++ b/releasenotes/notes/policy-dirs-91b7945f046e8fab.yaml @@ -0,0 +1,5 @@ +--- +features: + - | + There is now a new policy_dirs parameter in the glance::policy class, + so one can set a custom path. diff --git a/spec/classes/glance_policy_spec.rb b/spec/classes/glance_policy_spec.rb index d3859151..b0f97a90 100644 --- a/spec/classes/glance_policy_spec.rb +++ b/spec/classes/glance_policy_spec.rb @@ -7,6 +7,7 @@ describe 'glance::policy' do :enforce_scope => false, :enforce_new_defaults => false, :policy_path => '/etc/glance/policy.yaml', + :policy_dirs => '/etc/glance/policy.d', :policies => { 'context_is_admin' => { 'key' => 'context_is_admin', @@ -28,6 +29,7 @@ describe 'glance::policy' do :enforce_scope => false, :enforce_new_defaults => false, :policy_file => '/etc/glance/policy.yaml', + :policy_dirs => '/etc/glance/policy.d', ) end end