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: I296a34f14cb3cd88ac8a969d224ab7e55b79b137
This commit is contained in:
parent
498a763916
commit
2b6e3859c3
@ -20,12 +20,12 @@
|
||||
# Defaults to empty hash.
|
||||
#
|
||||
# [*policy_path*]
|
||||
# (Optional) Path to the nova policy.json file
|
||||
# Defaults to /etc/placement/policy.json
|
||||
# (Optional) Path to the nova policy.yaml file
|
||||
# Defaults to /etc/placement/policy.yaml
|
||||
#
|
||||
class placement::policy (
|
||||
$policies = {},
|
||||
$policy_path = '/etc/placement/policy.json',
|
||||
$policy_path = '/etc/placement/policy.yaml',
|
||||
) {
|
||||
|
||||
include placement::deps
|
||||
@ -34,9 +34,10 @@ class placement::policy (
|
||||
validate_legacy(Hash, 'validate_hash', $policies)
|
||||
|
||||
Openstacklib::Policy::Base {
|
||||
file_path => $policy_path,
|
||||
file_user => 'root',
|
||||
file_group => $::placement::params::group,
|
||||
file_path => $policy_path,
|
||||
file_user => 'root',
|
||||
file_group => $::placement::params::group,
|
||||
file_format => 'yaml',
|
||||
}
|
||||
|
||||
create_resources('openstacklib::policy::base', $policies)
|
||||
|
@ -0,0 +1,4 @@
|
||||
---
|
||||
upgrade:
|
||||
- |
|
||||
Now policy.yaml is used by default instead of policy.json.
|
@ -4,7 +4,7 @@ describe 'placement::policy' do
|
||||
shared_examples 'placement::policy' do
|
||||
let :params do
|
||||
{
|
||||
:policy_path => '/etc/placement/policy.json',
|
||||
:policy_path => '/etc/placement/policy.yaml',
|
||||
:policies => {
|
||||
'context_is_admin' => {
|
||||
'key' => 'context_is_admin',
|
||||
@ -14,12 +14,18 @@ describe 'placement::policy' do
|
||||
}
|
||||
end
|
||||
|
||||
it { is_expected.to contain_openstacklib__policy__base('context_is_admin').with(
|
||||
:key => 'context_is_admin',
|
||||
:value => 'foo:bar',
|
||||
:file_user => 'root',
|
||||
:file_group => 'placement',
|
||||
)}
|
||||
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',
|
||||
:file_group => 'placement',
|
||||
:file_format => 'yaml',
|
||||
)
|
||||
is_expected.to contain_oslo__policy('placement_config').with(
|
||||
:policy_file => '/etc/placement/policy.yaml',
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
on_supported_os({
|
||||
|
Loading…
Reference in New Issue
Block a user