Pass custom_wsgi_process_options to horizon::wsgi::apache

This adds the custom_wsgi_process_options parameter to
the horizon class that is passed down to the
horizon::wsgi::apache class when configure_apache is
set to true.

Change-Id: I986aeb9766a777eaf82f1f2fccfed95b380dc4c7
(cherry picked from commit cd5216f5a5)
This commit is contained in:
Tobias Urdin 2024-10-28 15:05:32 +01:00
parent 150fd178dc
commit 0613e18b33
3 changed files with 48 additions and 30 deletions

View File

@ -266,6 +266,14 @@
# (optional) Number of thread to run in a Horizon process # (optional) Number of thread to run in a Horizon process
# Defaults to '1' # Defaults to '1'
# #
# [*custom_wsgi_process_options*]
# (optional) gives you the opportunity to add custom process options or to
# overwrite the default options for the WSGI main process.
# eg. to use a virtual python environment for the WSGI process
# you could set it to:
# { python-path => '/my/python/virtualenv' }
# Defaults to {}
#
# [*vhost_extra_params*] # [*vhost_extra_params*]
# (optional) extra parameter to pass to the apache::vhost class # (optional) extra parameter to pass to the apache::vhost class
# Defaults to undef # Defaults to undef
@ -613,6 +621,7 @@ class horizon(
$ssl_verify_client = undef, $ssl_verify_client = undef,
$wsgi_processes = $facts['os_workers'], $wsgi_processes = $facts['os_workers'],
$wsgi_threads = '1', $wsgi_threads = '1',
$custom_wsgi_process_options = {},
Boolean $compress_enabled = true, Boolean $compress_enabled = true,
Boolean $compress_offline = true, Boolean $compress_offline = true,
Optional[Stdlib::Absolutepath] $compress_root = undef, Optional[Stdlib::Absolutepath] $compress_root = undef,
@ -789,24 +798,25 @@ Use PyMemcacheCache backend instead")
if $configure_apache { if $configure_apache {
class { 'horizon::wsgi::apache': class { 'horizon::wsgi::apache':
bind_address => $bind_address, bind_address => $bind_address,
servername => $servername, servername => $servername,
server_aliases => $server_aliases, server_aliases => $server_aliases,
listen_ssl => $listen_ssl, listen_ssl => $listen_ssl,
http_port => $http_port, http_port => $http_port,
https_port => $https_port, https_port => $https_port,
ssl_redirect => $ssl_redirect, ssl_redirect => $ssl_redirect,
ssl_cert => $ssl_cert, ssl_cert => $ssl_cert,
ssl_key => $ssl_key, ssl_key => $ssl_key,
ssl_ca => $ssl_ca, ssl_ca => $ssl_ca,
ssl_verify_client => $ssl_verify_client, ssl_verify_client => $ssl_verify_client,
wsgi_processes => $wsgi_processes, wsgi_processes => $wsgi_processes,
wsgi_threads => $wsgi_threads, wsgi_threads => $wsgi_threads,
extra_params => $vhost_extra_params, custom_wsgi_process_options => $custom_wsgi_process_options,
redirect_type => $redirect_type, extra_params => $vhost_extra_params,
root_url => $root_url, redirect_type => $redirect_type,
root_path => $root_path, root_url => $root_url,
access_log_format => $access_log_format, root_path => $root_path,
access_log_format => $access_log_format,
} }
} }

View File

@ -0,0 +1,5 @@
features:
- |
Added ``horizon::custom_wsgi_process_options`` parameter that is passed
down to the ``horizon::wsgi::apache`` class when ``configure_apache``
is set to true.

View File

@ -35,12 +35,13 @@ describe 'horizon' do
it 'configures apache' do it 'configures apache' do
is_expected.to contain_class('horizon::wsgi::apache').with({ is_expected.to contain_class('horizon::wsgi::apache').with({
:servername => 'foo.example.com', :servername => 'foo.example.com',
:listen_ssl => false, :listen_ssl => false,
:wsgi_processes => facts[:os_workers], :wsgi_processes => facts[:os_workers],
:wsgi_threads => '1', :wsgi_threads => '1',
:extra_params => {}, :custom_wsgi_process_options => {},
:redirect_type => 'permanent', :extra_params => {},
:redirect_type => 'permanent',
}) })
end end
@ -408,15 +409,17 @@ describe 'horizon' do
context 'with custom wsgi options' do context 'with custom wsgi options' do
before do before do
params.merge!( :wsgi_processes => '30', params.merge!( :wsgi_processes => '30',
:wsgi_threads => '5', :wsgi_threads => '5',
:access_log_format => 'common' ) :custom_wsgi_process_options => { 'python-env' => '/tmp/test' },
:access_log_format => 'common' )
end end
it { should contain_class('horizon::wsgi::apache').with( it { should contain_class('horizon::wsgi::apache').with(
:wsgi_processes => '30', :wsgi_processes => '30',
:wsgi_threads => '5', :wsgi_threads => '5',
:access_log_format => 'common', :custom_wsgi_process_options => { 'python-env' => '/tmp/test' },
:access_log_format => 'common',
)} )}
end end