Use yaml instead of json for policy file

Because usage of json for policy file will be deprecated and replaced
by yaml[1].

[1] https://governance.openstack.org/tc/goals/selected/wallaby/migrate-policy-format-from-json-to-yaml.html

Depends-on: https://review.opendev.org/769647
Change-Id: I4a3d5996beaaec649dbd076f29e80d6dc9705cbf
This commit is contained in:
Takashi Kajinami
2020-12-29 16:41:54 +09:00
parent 8b4cb48f99
commit 3c8553a898
3 changed files with 18 additions and 12 deletions

View File

@@ -20,12 +20,12 @@
# 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/cloudkitty/policy.json # Defaults to /etc/cloudkitty/policy.yaml
# #
class cloudkitty::policy ( class cloudkitty::policy (
$policies = {}, $policies = {},
$policy_path = '/etc/cloudkitty/policy.json', $policy_path = '/etc/cloudkitty/policy.yaml',
) { ) {
include cloudkitty::deps include cloudkitty::deps
@@ -37,6 +37,7 @@ class cloudkitty::policy (
file_path => $policy_path, file_path => $policy_path,
file_user => 'root', file_user => 'root',
file_group => $::cloudkitty::params::group, file_group => $::cloudkitty::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 'cloudkitty::policy' do
shared_examples_for 'cloudkitty policies' do shared_examples_for 'cloudkitty policies' do
let :params do let :params do
{ {
:policy_path => '/etc/cloudkitty/policy.json', :policy_path => '/etc/cloudkitty/policy.yaml',
:policies => { :policies => {
'context_is_admin' => { 'context_is_admin' => {
'key' => 'context_is_admin', 'key' => 'context_is_admin',
@@ -21,9 +21,10 @@ describe 'cloudkitty::policy' do
:value => 'foo:bar', :value => 'foo:bar',
:file_user => 'root', :file_user => 'root',
:file_group => 'cloudkitty', :file_group => 'cloudkitty',
:file_format => 'yaml',
}) })
is_expected.to contain_oslo__policy('cloudkitty_config').with( is_expected.to contain_oslo__policy('cloudkitty_config').with(
:policy_file => '/etc/cloudkitty/policy.json', :policy_file => '/etc/cloudkitty/policy.yaml',
) )
end end
end end