Add support for the oslo_policy/enforce_scope parameter
Depends-on: https://review.opendev.org/#/c/759008/ Change-Id: Ief74bb444f72dae125e73e611c8412b118ae0ee9
This commit is contained in:
parent
d9552ad11f
commit
607d8a854d
@ -4,6 +4,10 @@
|
||||
#
|
||||
# === Parameters
|
||||
#
|
||||
# [*enforce_scope*]
|
||||
# (Optional) Whether or not to enforce scope when evaluating policies.
|
||||
# Defaults to $::os_service_default.
|
||||
#
|
||||
# [*policies*]
|
||||
# (Optional) Set of policies to configure for nova
|
||||
# Example :
|
||||
@ -24,6 +28,7 @@
|
||||
# Defaults to /etc/nova/policy.yaml
|
||||
#
|
||||
class nova::policy (
|
||||
$enforce_scope = $::os_service_default,
|
||||
$policies = {},
|
||||
$policy_path = '/etc/nova/policy.yaml',
|
||||
) {
|
||||
@ -33,15 +38,18 @@ class nova::policy (
|
||||
|
||||
validate_legacy(Hash, 'validate_hash', $policies)
|
||||
|
||||
$policy_defaults = {
|
||||
Openstacklib::Policy::Base {
|
||||
file_path => $policy_path,
|
||||
file_user => 'root',
|
||||
file_group => $::nova::params::group,
|
||||
file_format => 'yaml',
|
||||
}
|
||||
|
||||
create_resources('openstacklib::policy::base', $policies, $policy_defaults)
|
||||
create_resources('openstacklib::policy::base', $policies)
|
||||
|
||||
oslo::policy { 'nova_config': policy_file => $policy_path }
|
||||
oslo::policy { 'nova_config':
|
||||
enforce_scope => $enforce_scope,
|
||||
policy_file => $policy_path
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,5 @@
|
||||
---
|
||||
features:
|
||||
- |
|
||||
The new ``nova::policy::enforce_scope`` parameter has been added to
|
||||
support the corresponding parameter in oslo.policy library.
|
@ -1,10 +1,10 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'nova::policy' do
|
||||
|
||||
shared_examples_for 'nova policies' do
|
||||
shared_examples 'nova::policy' do
|
||||
let :params do
|
||||
{
|
||||
:enforce_scope => false,
|
||||
:policy_path => '/etc/nova/policy.yaml',
|
||||
:policies => {
|
||||
'context_is_admin' => {
|
||||
@ -24,6 +24,7 @@ describe 'nova::policy' do
|
||||
:file_format => 'yaml',
|
||||
})
|
||||
is_expected.to contain_oslo__policy('nova_config').with(
|
||||
:enforce_scope => false,
|
||||
:policy_file => '/etc/nova/policy.yaml',
|
||||
)
|
||||
end
|
||||
@ -37,8 +38,7 @@ describe 'nova::policy' do
|
||||
facts.merge!(OSDefaults.get_facts())
|
||||
end
|
||||
|
||||
it_configures 'nova policies'
|
||||
it_behaves_like 'nova::policy'
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user