Browse Source

Do not convert policy_dirs to comma-separated list

The oslo_policy/policy_dirs parameter is not ListOpt but MultiStrOpt,
thus it expects multi line configruation instead of a comma separeted
list.

Closes-Bug: #1922044
Change-Id: Id183859e7cb936e1f70abb1bb26e071dd19b82a5
changes/59/784059/3
Takashi Kajinami 1 month ago
parent
commit
3ae2625ea8
2 changed files with 3 additions and 20 deletions
  1. +1
    -6
      manifests/policy.pp
  2. +2
    -14
      spec/defines/oslo_policy_spec.rb

+ 1
- 6
manifests/policy.pp View File

@ -40,18 +40,13 @@ define oslo::policy(
$policy_default_rule = $::os_service_default,
$policy_dirs = $::os_service_default,
) {
if !is_service_default($policy_dirs) {
$policy_dirs_orig = join(any2array($policy_dirs), ',')
} else {
$policy_dirs_orig = $policy_dirs
}
$policy_options = {
'oslo_policy/enforce_scope' => { value => $enforce_scope },
'oslo_policy/enforce_new_defaults' => { value => $enforce_new_defaults },
'oslo_policy/policy_file' => { value => $policy_file },
'oslo_policy/policy_default_rule' => { value => $policy_default_rule },
'oslo_policy/policy_dirs' => { value => $policy_dirs_orig },
'oslo_policy/policy_dirs' => { value => $policy_dirs },
}
create_resources($name, $policy_options)


+ 2
- 14
spec/defines/oslo_policy_spec.rb View File

@ -23,7 +23,7 @@ describe 'oslo::policy' do
:enforce_new_defaults => false,
:policy_file => '/path/to/policy.file',
:policy_default_rule => 'some rule',
:policy_dirs => ['dir1', '/dir/2'],
:policy_dirs => 'dir1',
}
end
@ -32,19 +32,7 @@ describe 'oslo::policy' do
is_expected.to contain_keystone_config('oslo_policy/enforce_new_defaults').with_value(false)
is_expected.to contain_keystone_config('oslo_policy/policy_file').with_value('/path/to/policy.file')
is_expected.to contain_keystone_config('oslo_policy/policy_default_rule').with_value('some rule')
is_expected.to contain_keystone_config('oslo_policy/policy_dirs').with_value('dir1,/dir/2')
end
end
context 'with string in list parameters' do
let :params do
{
:policy_dirs => 'dir1,/dir/2',
}
end
it 'configures oslo_policy section with overridden list values as strings' do
is_expected.to contain_keystone_config('oslo_policy/policy_dirs').with_value('dir1,/dir/2')
is_expected.to contain_keystone_config('oslo_policy/policy_dirs').with_value('dir1')
end
end
end


Loading…
Cancel
Save