[novajoin] Use yaml instead of json for policy file

This replaces the remaining usage of policy.json in novajoin with
policy.yaml, because json format will be deprecated[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: I6272d37c4c5a927236660c96522590face337715
This commit is contained in:
Takashi Kajinami 2021-03-16 18:49:56 +09:00
parent d9552ad11f
commit c57f9f9e80
2 changed files with 12 additions and 10 deletions

View File

@ -16,19 +16,20 @@
# Defaults to empty hash.
#
# [*policy_path*]
# (Optional) Path to the novajoin policy.json file
# Defaults to /etc/novajoin/policy.json
# (Optional) Path to the novajoin policy.yaml file
# Defaults to /etc/novajoin/policy.yaml
#
class nova::metadata::novajoin::policy (
$policies = {},
$policy_path = '/etc/novajoin/policy.json',
$policy_path = '/etc/novajoin/policy.yaml',
) {
validate_legacy(Hash, 'validate_hash', $policies)
$policy_defaults = {
file_path => $policy_path,
file_user => 'root',
file_path => $policy_path,
file_user => 'root',
file_format => 'yaml',
}
create_resources('openstacklib::policy::base', $policies, $policy_defaults)

View File

@ -5,7 +5,7 @@ describe 'nova::metadata::novajoin::policy' do
shared_examples_for 'novajoin policies' do
let :params do
{
:policy_path => '/etc/novajoin/policy.json',
:policy_path => '/etc/novajoin/policy.yaml',
:policies => {
'context_is_admin' => {
'key' => 'context_is_admin',
@ -17,12 +17,13 @@ describe 'nova::metadata::novajoin::policy' do
it 'set up the policies' do
is_expected.to contain_openstacklib__policy__base('context_is_admin').with({
:key => 'context_is_admin',
:value => 'foo:bar',
:file_user => 'root',
:key => 'context_is_admin',
:value => 'foo:bar',
:file_user => 'root',
:file_format => 'yaml',
})
is_expected.to contain_oslo__policy('novajoin_config').with(
:policy_file => '/etc/novajoin/policy.json',
:policy_file => '/etc/novajoin/policy.yaml',
)
end
end