diff --git a/manifests/engine.pp b/manifests/engine.pp index 009189cb..0e71a33c 100644 --- a/manifests/engine.pp +++ b/manifests/engine.pp @@ -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; } } diff --git a/releasenotes/notes/add_plugin_dirs_parameter-20c755fbdb22c58d.yaml b/releasenotes/notes/add_plugin_dirs_parameter-20c755fbdb22c58d.yaml new file mode 100644 index 00000000..5b85e7e2 --- /dev/null +++ b/releasenotes/notes/add_plugin_dirs_parameter-20c755fbdb22c58d.yaml @@ -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. diff --git a/spec/classes/heat_engine_spec.rb b/spec/classes/heat_engine_spec.rb index e46b11ac..b4ad0909 100644 --- a/spec/classes/heat_engine_spec.rb +++ b/spec/classes/heat_engine_spec.rb @@ -20,6 +20,7 @@ describe 'heat::engine' do :environment_dir => '', :template_dir => '', :max_nested_stack_depth => '', + :plugin_dirs => '', } 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('') } 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!({