[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,19 +16,20 @@
|
|||||||
# Defaults to empty hash.
|
# Defaults to empty hash.
|
||||||
#
|
#
|
||||||
# [*policy_path*]
|
# [*policy_path*]
|
||||||
# (Optional) Path to the novajoin policy.json file
|
# (Optional) Path to the novajoin policy.yaml file
|
||||||
# Defaults to /etc/novajoin/policy.json
|
# Defaults to /etc/novajoin/policy.yaml
|
||||||
#
|
#
|
||||||
class nova::metadata::novajoin::policy (
|
class nova::metadata::novajoin::policy (
|
||||||
$policies = {},
|
$policies = {},
|
||||||
$policy_path = '/etc/novajoin/policy.json',
|
$policy_path = '/etc/novajoin/policy.yaml',
|
||||||
) {
|
) {
|
||||||
|
|
||||||
validate_legacy(Hash, 'validate_hash', $policies)
|
validate_legacy(Hash, 'validate_hash', $policies)
|
||||||
|
|
||||||
$policy_defaults = {
|
$policy_defaults = {
|
||||||
file_path => $policy_path,
|
file_path => $policy_path,
|
||||||
file_user => 'root',
|
file_user => 'root',
|
||||||
|
file_format => 'yaml',
|
||||||
}
|
}
|
||||||
|
|
||||||
create_resources('openstacklib::policy::base', $policies, $policy_defaults)
|
create_resources('openstacklib::policy::base', $policies, $policy_defaults)
|
||||||
|
@@ -5,7 +5,7 @@ describe 'nova::metadata::novajoin::policy' do
|
|||||||
shared_examples_for 'novajoin policies' do
|
shared_examples_for 'novajoin policies' do
|
||||||
let :params do
|
let :params do
|
||||||
{
|
{
|
||||||
:policy_path => '/etc/novajoin/policy.json',
|
:policy_path => '/etc/novajoin/policy.yaml',
|
||||||
:policies => {
|
:policies => {
|
||||||
'context_is_admin' => {
|
'context_is_admin' => {
|
||||||
'key' => 'context_is_admin',
|
'key' => 'context_is_admin',
|
||||||
@@ -17,12 +17,13 @@ describe 'nova::metadata::novajoin::policy' do
|
|||||||
|
|
||||||
it 'set up the policies' do
|
it 'set up the policies' do
|
||||||
is_expected.to contain_openstacklib__policy__base('context_is_admin').with({
|
is_expected.to contain_openstacklib__policy__base('context_is_admin').with({
|
||||||
:key => 'context_is_admin',
|
:key => 'context_is_admin',
|
||||||
:value => 'foo:bar',
|
:value => 'foo:bar',
|
||||||
:file_user => 'root',
|
:file_user => 'root',
|
||||||
|
:file_format => 'yaml',
|
||||||
})
|
})
|
||||||
is_expected.to contain_oslo__policy('novajoin_config').with(
|
is_expected.to contain_oslo__policy('novajoin_config').with(
|
||||||
:policy_file => '/etc/novajoin/policy.json',
|
:policy_file => '/etc/novajoin/policy.yaml',
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Reference in New Issue
Block a user