Add support for the oslo_policy/enforce_scope parameter
Depends-on: https://review.opendev.org/#/c/759008/ Change-Id: I9c15693bfcb5b9f9ba71b32ffd4a50f4da67f44c
This commit is contained in:
parent
1518eafd3d
commit
99852a016d
@ -4,6 +4,10 @@
|
|||||||
#
|
#
|
||||||
# === Parameters
|
# === Parameters
|
||||||
#
|
#
|
||||||
|
# [*enforce_scope*]
|
||||||
|
# (Optional) Whether or not to enforce scope when evaluating policies.
|
||||||
|
# Defaults to $::os_service_default.
|
||||||
|
#
|
||||||
# [*policies*]
|
# [*policies*]
|
||||||
# (Optional) Set of policies to configure for neutron
|
# (Optional) Set of policies to configure for neutron
|
||||||
# Example :
|
# Example :
|
||||||
@ -24,8 +28,9 @@
|
|||||||
# Defaults to /etc/neutron/policy.yaml
|
# Defaults to /etc/neutron/policy.yaml
|
||||||
#
|
#
|
||||||
class neutron::policy (
|
class neutron::policy (
|
||||||
$policies = {},
|
$enforce_scope = $::os_service_default,
|
||||||
$policy_path = '/etc/neutron/policy.yaml',
|
$policies = {},
|
||||||
|
$policy_path = '/etc/neutron/policy.yaml',
|
||||||
) {
|
) {
|
||||||
|
|
||||||
include neutron::deps
|
include neutron::deps
|
||||||
@ -42,6 +47,9 @@ class neutron::policy (
|
|||||||
|
|
||||||
create_resources('openstacklib::policy::base', $policies)
|
create_resources('openstacklib::policy::base', $policies)
|
||||||
|
|
||||||
oslo::policy { 'neutron_config': policy_file => $policy_path }
|
oslo::policy { 'neutron_config':
|
||||||
|
enforce_scope => $enforce_scope,
|
||||||
|
policy_file => $policy_path
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
features:
|
||||||
|
- |
|
||||||
|
The new ``neutron::policy::enforce_scope`` parameter has been added to
|
||||||
|
support the corresponding parameter in oslo.policy library.
|
@ -1,11 +1,12 @@
|
|||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
describe 'neutron::policy' do
|
describe 'neutron::policy' do
|
||||||
shared_examples 'neutron policies' do
|
shared_examples 'neutron::policy' do
|
||||||
let :params do
|
let :params do
|
||||||
{
|
{
|
||||||
:policy_path => '/etc/neutron/policy.yaml',
|
:enforce_scope => false,
|
||||||
:policies => {
|
:policy_path => '/etc/neutron/policy.yaml',
|
||||||
|
:policies => {
|
||||||
'context_is_admin' => {
|
'context_is_admin' => {
|
||||||
'key' => 'context_is_admin',
|
'key' => 'context_is_admin',
|
||||||
'value' => 'foo:bar'
|
'value' => 'foo:bar'
|
||||||
@ -15,28 +16,29 @@ describe 'neutron::policy' do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it 'set up the policies' do
|
it 'set up the policies' do
|
||||||
should 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 => 'neutron',
|
:file_group => 'neutron',
|
||||||
:file_format => 'yaml',
|
:file_format => 'yaml',
|
||||||
})
|
})
|
||||||
should contain_oslo__policy('neutron_config').with(
|
is_expected.to contain_oslo__policy('neutron_config').with(
|
||||||
:policy_file => '/etc/neutron/policy.yaml',
|
:enforce_scope => false,
|
||||||
|
:policy_file => '/etc/neutron/policy.yaml',
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
on_supported_os({
|
on_supported_os({
|
||||||
:supported_os => OSDefaults.get_supported_os
|
:supported_os => OSDefaults.get_supported_os
|
||||||
}).each do |os,facts|
|
}).each do |os,facts|
|
||||||
context "on #{os}" do
|
context "on #{os}" do
|
||||||
let (:facts) do
|
let (:facts) do
|
||||||
facts.merge!(OSDefaults.get_facts())
|
facts.merge!(OSDefaults.get_facts())
|
||||||
end
|
end
|
||||||
|
|
||||||
it_behaves_like 'neutron policies'
|
it_behaves_like 'neutron::policy'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user