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: I77d93d67f08f07928b9a561f2797ce39ae5824ac
This commit is contained in:
parent
9d60cbfade
commit
d7c60692ab
|
@ -20,12 +20,12 @@
|
||||||
# Defaults to empty hash.
|
# Defaults to empty hash.
|
||||||
#
|
#
|
||||||
# [*policy_path*]
|
# [*policy_path*]
|
||||||
# (Optional) Path to the ironic policy.json file
|
# (Optional) Path to the ironic policy.yaml file
|
||||||
# Defaults to /etc/ironic/policy.json
|
# Defaults to /etc/ironic/policy.yaml
|
||||||
#
|
#
|
||||||
class ironic::policy (
|
class ironic::policy (
|
||||||
$policies = {},
|
$policies = {},
|
||||||
$policy_path = '/etc/ironic/policy.json',
|
$policy_path = '/etc/ironic/policy.yaml',
|
||||||
) {
|
) {
|
||||||
|
|
||||||
include ironic::deps
|
include ironic::deps
|
||||||
|
@ -34,9 +34,10 @@ class ironic::policy (
|
||||||
validate_legacy(Hash, 'validate_hash', $policies)
|
validate_legacy(Hash, 'validate_hash', $policies)
|
||||||
|
|
||||||
Openstacklib::Policy::Base {
|
Openstacklib::Policy::Base {
|
||||||
file_path => $policy_path,
|
file_path => $policy_path,
|
||||||
file_user => 'root',
|
file_user => 'root',
|
||||||
file_group => $::ironic::params::group,
|
file_group => $::ironic::params::group,
|
||||||
|
file_format => 'yaml',
|
||||||
}
|
}
|
||||||
|
|
||||||
create_resources('openstacklib::policy::base', $policies)
|
create_resources('openstacklib::policy::base', $policies)
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
---
|
||||||
|
upgrade:
|
||||||
|
- |
|
||||||
|
Now policy.yaml is used by default instead of policy.json.
|
|
@ -5,7 +5,7 @@ describe 'ironic::policy' do
|
||||||
shared_examples_for 'ironic policies' do
|
shared_examples_for 'ironic policies' do
|
||||||
let :params do
|
let :params do
|
||||||
{
|
{
|
||||||
:policy_path => '/etc/ironic/policy.json',
|
:policy_path => '/etc/ironic/policy.yaml',
|
||||||
:policies => {
|
:policies => {
|
||||||
'context_is_admin' => {
|
'context_is_admin' => {
|
||||||
'key' => 'context_is_admin',
|
'key' => 'context_is_admin',
|
||||||
|
@ -17,13 +17,14 @@ describe 'ironic::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_group => 'ironic',
|
:file_group => 'ironic',
|
||||||
|
:file_format => 'yaml',
|
||||||
})
|
})
|
||||||
is_expected.to contain_oslo__policy('ironic_config').with(
|
is_expected.to contain_oslo__policy('ironic_config').with(
|
||||||
:policy_file => '/etc/ironic/policy.json',
|
:policy_file => '/etc/ironic/policy.yaml',
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue