Make heat parameter plugin_dirs configurable

Heat has an additional configuration for plugin_dirs
parameter. This parameter provides a list of directories
to search for plug-ins. This change allows configuration
of plugin_dirs parameter in heat.conf file. This change
will allow a user to set this value, if required. Else
$::os_service_default will be used and the parameter will
not be added to the config file, as it is done today.

Change-Id: I636d52f867ee447eaf0e1e80bf9fdc30c91f4ec1
This commit is contained in:
Lokesh Jain 2018-01-22 18:41:20 -05:00
parent 7870a0f8ff
commit 56cbd7c89b
3 changed files with 34 additions and 0 deletions

View File

@ -125,6 +125,10 @@
# (Optional) Maximum depth allowed when using nested stacks.
# Defaults to $::os_service_default
#
# [*plugin_dirs*]
# (Optional) List of directories to search for plug-ins.
# Defaults to $::os_service_default
#
class heat::engine (
$auth_encryption_key,
$package_ensure = 'present',
@ -149,6 +153,7 @@ class heat::engine (
$environment_dir = $::os_service_default,
$template_dir = $::os_service_default,
$max_nested_stack_depth = $::os_service_default,
$plugin_dirs = $::os_service_default,
) {
include ::heat::deps
@ -165,6 +170,17 @@ class heat::engine (
include ::heat
include ::heat::params
# plugin_dirs value follows these rules:
# - default is $::os_service_default so Puppet won't try to configure it.
# - if set, array validation will be done for not empty and then configure the parameter.
# - Otherwise, fallback to default.
if !is_service_default($plugin_dirs) and !empty($plugin_dirs) {
validate_array($plugin_dirs)
$plugin_dirs_real = join($plugin_dirs, ',')
} else {
$plugin_dirs_real = $::os_service_default
}
package { 'heat-engine':
ensure => $package_ensure,
name => $::heat::params::engine_package_name,
@ -209,5 +225,6 @@ class heat::engine (
'DEFAULT/environment_dir': value => $environment_dir;
'DEFAULT/template_dir': value => $template_dir;
'DEFAULT/max_nested_stack_depth': value => $max_nested_stack_depth;
'DEFAULT/plugin_dirs': value => $plugin_dirs_real;
}
}

View File

@ -0,0 +1,6 @@
---
features:
- Heat has additional configuration option for plugin_dirs
parameter. This parameter provides a list of directories
to search for plug-ins. This change allows configuration
of plugin_dirs parameter in heat.conf file.

View File

@ -20,6 +20,7 @@ describe 'heat::engine' do
:environment_dir => '<SERVICE DEFAULT>',
:template_dir => '<SERVICE DEFAULT>',
:max_nested_stack_depth => '<SERVICE DEFAULT>',
:plugin_dirs => '<SERVICE DEFAULT>',
}
end
@ -96,6 +97,7 @@ describe 'heat::engine' do
it { is_expected.to contain_heat_config('DEFAULT/reauthentication_auth_method').with_value( expected_params[:reauthentication_auth_method] ) }
it { is_expected.to contain_heat_config('DEFAULT/environment_dir').with_value( expected_params[:environment_dir] ) }
it { is_expected.to contain_heat_config('DEFAULT/template_dir').with_value( expected_params[:template_dir] ) }
it { is_expected.to contain_heat_config('DEFAULT/plugin_dirs').with_value('<SERVICE DEFAULT>') }
end
context 'with disabled service managing' do
@ -114,6 +116,15 @@ describe 'heat::engine' do
:tag => 'heat-service',
) }
end
context 'with plugin_dirs value set' do
before do
params.merge!({
:plugin_dirs => ['/usr/lib/heat', '/usr/local/lib/heat'] })
end
it { is_expected.to contain_heat_config('DEFAULT/plugin_dirs').with_value(['/usr/lib/heat,/usr/local/lib/heat']) }
end
context 'with wrong auth_encryption_key parameter size' do
before do
params.merge!({