Add support for oslo_policy/enforce_new_defaults
Depends-on: https://review.opendev.org/781428 Change-Id: I86612e45c6d5d7d675098b7beb1c19ff903a53db
This commit is contained in:
parent
3b4a1e5a90
commit
f83af35e66
|
@ -8,6 +8,11 @@
|
||||||
# (Optional) Whether or not to enforce scope when evaluating policies.
|
# (Optional) Whether or not to enforce scope when evaluating policies.
|
||||||
# Defaults to $::os_service_default.
|
# Defaults to $::os_service_default.
|
||||||
#
|
#
|
||||||
|
# [*enforce_new_defaults*]
|
||||||
|
# (Optional) Whether or not to use old deprecated defaults when evaluating
|
||||||
|
# policies.
|
||||||
|
# Defaults to $::os_service_default.
|
||||||
|
#
|
||||||
# [*policies*]
|
# [*policies*]
|
||||||
# (Optional) Set of policies to configure for ironic
|
# (Optional) Set of policies to configure for ironic
|
||||||
# Example :
|
# Example :
|
||||||
|
@ -28,9 +33,10 @@
|
||||||
# Defaults to /etc/ironic/policy.yaml
|
# Defaults to /etc/ironic/policy.yaml
|
||||||
#
|
#
|
||||||
class ironic::policy (
|
class ironic::policy (
|
||||||
$enforce_scope = $::os_service_default,
|
$enforce_scope = $::os_service_default,
|
||||||
$policies = {},
|
$enforce_new_defaults = $::os_service_default,
|
||||||
$policy_path = '/etc/ironic/policy.yaml',
|
$policies = {},
|
||||||
|
$policy_path = '/etc/ironic/policy.yaml',
|
||||||
) {
|
) {
|
||||||
|
|
||||||
include ironic::deps
|
include ironic::deps
|
||||||
|
@ -48,8 +54,9 @@ class ironic::policy (
|
||||||
create_resources('openstacklib::policy::base', $policies)
|
create_resources('openstacklib::policy::base', $policies)
|
||||||
|
|
||||||
oslo::policy { 'ironic_config':
|
oslo::policy { 'ironic_config':
|
||||||
enforce_scope => $enforce_scope,
|
enforce_scope => $enforce_scope,
|
||||||
policy_file => $policy_path
|
enforce_new_defaults => $enforce_new_defaults,
|
||||||
|
policy_file => $policy_path
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
features:
|
||||||
|
- |
|
||||||
|
The new ``ironic::policy::enforce_new_defaults`` parameter has been
|
||||||
|
added.
|
|
@ -4,9 +4,10 @@ describe 'ironic::policy' do
|
||||||
shared_examples 'ironic::policy' do
|
shared_examples 'ironic::policy' do
|
||||||
let :params do
|
let :params do
|
||||||
{
|
{
|
||||||
:enforce_scope => false,
|
:enforce_scope => false,
|
||||||
:policy_path => '/etc/ironic/policy.yaml',
|
:enforce_new_defaults => false,
|
||||||
:policies => {
|
:policy_path => '/etc/ironic/policy.yaml',
|
||||||
|
:policies => {
|
||||||
'context_is_admin' => {
|
'context_is_admin' => {
|
||||||
'key' => 'context_is_admin',
|
'key' => 'context_is_admin',
|
||||||
'value' => 'foo:bar'
|
'value' => 'foo:bar'
|
||||||
|
@ -24,8 +25,9 @@ describe 'ironic::policy' do
|
||||||
:file_format => 'yaml',
|
:file_format => 'yaml',
|
||||||
})
|
})
|
||||||
is_expected.to contain_oslo__policy('ironic_config').with(
|
is_expected.to contain_oslo__policy('ironic_config').with(
|
||||||
:enforce_scope => false,
|
:enforce_scope => false,
|
||||||
:policy_file => '/etc/ironic/policy.yaml',
|
:enforce_new_defaults => false,
|
||||||
|
:policy_file => '/etc/ironic/policy.yaml',
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue