Merge "Support purging local_settings.d"

This commit is contained in:
Zuul 2023-11-16 05:11:35 +00:00 committed by Gerrit Code Review
commit 678f359196
3 changed files with 32 additions and 4 deletions

View File

@ -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'],

View File

@ -0,0 +1,4 @@
---
features:
- |
The new ``horizon::purge_conf_d_dir`` parameter has been added.

View File

@ -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]) }