Merge "Use yaml instead of json for policy file"

This commit is contained in:
Zuul 2021-01-14 21:56:42 +00:00 committed by Gerrit Code Review
commit 0c3fcfbd0b
3 changed files with 20 additions and 14 deletions

View File

@ -20,12 +20,12 @@
# Defaults to empty hash.
#
# [*policy_path*]
# (Optional) Path to the glance policy.json file
# Defaults to /etc/glance/policy.json
# (Optional) Path to the glance policy.yaml file
# Defaults to /etc/glance/policy.yaml
#
class glance::policy (
$policies = {},
$policy_path = '/etc/glance/policy.json',
$policy_path = '/etc/glance/policy.yaml',
) {
include glance::deps
@ -37,6 +37,7 @@ class glance::policy (
file_path => $policy_path,
file_user => 'root',
file_group => $::glance::params::group,
file_format => 'yaml',
require => Anchor['glance::config::begin'],
notify => Anchor['glance::config::end'],
}

View File

@ -0,0 +1,4 @@
---
upgrade:
- |
Now policy.yaml is used by default instead of policy.json.

View File

@ -5,7 +5,7 @@ describe 'glance::policy' do
shared_examples_for 'glance policies' do
let :params do
{
:policy_path => '/etc/glance/policy.json',
:policy_path => '/etc/glance/policy.yaml',
:policies => {
'context_is_admin' => {
'key' => 'context_is_admin',
@ -21,9 +21,10 @@ describe 'glance::policy' do
:value => 'foo:bar',
:file_user => 'root',
:file_group => 'glance',
:file_format => 'yaml',
})
is_expected.to contain_oslo__policy('glance_api_config').with(
:policy_file => '/etc/glance/policy.json',
:policy_file => '/etc/glance/policy.yaml',
)
end
end