diff --git a/manifests/init.pp b/manifests/init.pp index ef11e5c9..db31142d 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -8,6 +8,13 @@ # (required) Secret key. This is used by Django to provide cryptographic # signing, and should be set to a unique, unpredictable value. # +# [*package_ensure*] +# (optional) Package ensure state. Defaults to 'present'. +# +# [*purge_conf_d_dir*] +# (optional) Purge files in the local_settings.d directory +# Defaults to false +# # [*servername*] # (optional) FQDN used for the Server Name directives # Defaults to facts['networking']['fqdn']. @@ -24,9 +31,6 @@ # in vhost.conf. # Defaults to facts['networking']['fqdn']. # -# [*package_ensure*] -# (optional) Package ensure state. Defaults to 'present'. -# # [*cache_backend*] # (optional) Horizon cache backend. # Defaults: 'django.core.cache.backends.locmem.LocMemCache' @@ -534,6 +538,7 @@ class horizon( $secret_key, $package_ensure = 'present', + Boolean $purge_conf_d_dir = false, $cache_backend = 'django.core.cache.backends.locmem.LocMemCache', $cache_options = undef, $cache_timeout = undef, @@ -723,6 +728,8 @@ class horizon( file { $::horizon::params::conf_d_dir: ensure => 'directory', mode => '0755', + purge => $purge_conf_d_dir, + recurse => $purge_conf_d_dir, owner => $::horizon::params::wsgi_user, group => $::horizon::params::wsgi_group, require => Anchor['horizon::config::begin'], diff --git a/releasenotes/notes/purge-conf_d_dir-daeefef45e54dcf7.yaml b/releasenotes/notes/purge-conf_d_dir-daeefef45e54dcf7.yaml new file mode 100644 index 00000000..16cf7d5a --- /dev/null +++ b/releasenotes/notes/purge-conf_d_dir-daeefef45e54dcf7.yaml @@ -0,0 +1,4 @@ +--- +features: + - | + The new ``horizon::purge_conf_d_dir`` parameter has been added. diff --git a/spec/classes/horizon_init_spec.rb b/spec/classes/horizon_init_spec.rb index 96b2345a..7b0f3c69 100644 --- a/spec/classes/horizon_init_spec.rb +++ b/spec/classes/horizon_init_spec.rb @@ -67,6 +67,15 @@ describe 'horizon' do expect(content).not_to match(/^SESSION_ENGINE/) end + it { is_expected.to contain_file(platforms_params[:conf_d_dir]).with( + :ensure => 'directory', + :mode => '0755', + :purge => false, + :recurse => false, + :owner => platforms_params[:wsgi_user], + :group => platforms_params[:wsgi_group], + ) } + it 'creates a key file' do is_expected.to contain_file(platforms_params[:secret_key_file]).with( :mode => '0600', @@ -82,6 +91,7 @@ describe 'horizon' do context 'with overridden parameters' do before do params.merge!({ + :purge_conf_d_dir => true, :cache_backend => 'django.core.cache.backends.memcached.MemcachedCache', :cache_timeout => 300, :cache_options => {'SOCKET_TIMEOUT' => 1,'SERVER_RETRIES' => 1,'DEAD_RETRY' => 1}, @@ -212,7 +222,14 @@ describe 'horizon' do ]) end - it { is_expected.to contain_file(platforms_params[:conf_d_dir]).with_ensure('directory') } + it { is_expected.to contain_file(platforms_params[:conf_d_dir]).with( + :ensure => 'directory', + :mode => '0755', + :purge => true, + :recurse => true, + :owner => platforms_params[:wsgi_user], + :group => platforms_params[:wsgi_group], + ) } it { is_expected.to_not contain_exec('refresh_horizon_django_compress') } it { is_expected.to contain_file(params[:file_upload_temp_dir]) }