Merge "Use yaml instead of json for policy file"

This commit is contained in:
Zuul
2021-01-25 20:14:20 +00:00
committed by Gerrit Code Review
3 changed files with 18 additions and 12 deletions

View File

@@ -24,13 +24,13 @@
# Defaults to empty hash. # Defaults to empty hash.
# #
# [*policy_path*] # [*policy_path*]
# (Optional) Path to the nova policy.json file # (Optional) Path to the nova policy.yaml file
# Defaults to /etc/keystone/policy.json # Defaults to /etc/keystone/policy.yaml
# #
class keystone::policy ( class keystone::policy (
$enforce_scope = $::os_service_default, $enforce_scope = $::os_service_default,
$policies = {}, $policies = {},
$policy_path = '/etc/keystone/policy.json', $policy_path = '/etc/keystone/policy.yaml',
) { ) {
include keystone::deps include keystone::deps
@@ -42,6 +42,7 @@ class keystone::policy (
file_path => $policy_path, file_path => $policy_path,
file_user => 'root', file_user => 'root',
file_group => $::keystone::params::group, file_group => $::keystone::params::group,
file_format => 'yaml',
} }
create_resources('openstacklib::policy::base', $policies) create_resources('openstacklib::policy::base', $policies)

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 'keystone::policy' do
let :params do let :params do
{ {
:enforce_scope => false, :enforce_scope => false,
:policy_path => '/etc/keystone/policy.json', :policy_path => '/etc/keystone/policy.yaml',
:policies => { :policies => {
'context_is_admin' => { 'context_is_admin' => {
'key' => 'context_is_admin', 'key' => 'context_is_admin',
@@ -21,10 +21,11 @@ describe 'keystone::policy' do
:value => 'foo:bar', :value => 'foo:bar',
:file_user => 'root', :file_user => 'root',
:file_group => 'keystone', :file_group => 'keystone',
:file_format => 'yaml',
}) })
is_expected.to contain_oslo__policy('keystone_config').with( is_expected.to contain_oslo__policy('keystone_config').with(
:enforce_scope => false, :enforce_scope => false,
:policy_file => '/etc/keystone/policy.json', :policy_file => '/etc/keystone/policy.yaml',
) )
end end
end end