[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:
@@ -16,12 +16,12 @@
|
||||
# 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)
|
||||
@@ -29,6 +29,7 @@ class nova::metadata::novajoin::policy (
|
||||
$policy_defaults = {
|
||||
file_path => $policy_path,
|
||||
file_user => 'root',
|
||||
file_format => 'yaml',
|
||||
}
|
||||
|
||||
create_resources('openstacklib::policy::base', $policies, $policy_defaults)
|
||||
|
@@ -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',
|
||||
@@ -20,9 +20,10 @@ describe 'nova::metadata::novajoin::policy' do
|
||||
: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
|
||||
|
Reference in New Issue
Block a user