diff --git a/manifests/init.pp b/manifests/init.pp index e8f22932..d52dc658 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -266,6 +266,14 @@ # (optional) Number of thread to run in a Horizon process # 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*] # (optional) extra parameter to pass to the apache::vhost class # Defaults to undef @@ -613,6 +621,7 @@ class horizon( $ssl_verify_client = undef, $wsgi_processes = $facts['os_workers'], $wsgi_threads = '1', + $custom_wsgi_process_options = {}, Boolean $compress_enabled = true, Boolean $compress_offline = true, Optional[Stdlib::Absolutepath] $compress_root = undef, @@ -789,24 +798,25 @@ Use PyMemcacheCache backend instead") if $configure_apache { class { 'horizon::wsgi::apache': - bind_address => $bind_address, - servername => $servername, - server_aliases => $server_aliases, - listen_ssl => $listen_ssl, - http_port => $http_port, - https_port => $https_port, - ssl_redirect => $ssl_redirect, - ssl_cert => $ssl_cert, - ssl_key => $ssl_key, - ssl_ca => $ssl_ca, - ssl_verify_client => $ssl_verify_client, - wsgi_processes => $wsgi_processes, - wsgi_threads => $wsgi_threads, - extra_params => $vhost_extra_params, - redirect_type => $redirect_type, - root_url => $root_url, - root_path => $root_path, - access_log_format => $access_log_format, + bind_address => $bind_address, + servername => $servername, + server_aliases => $server_aliases, + listen_ssl => $listen_ssl, + http_port => $http_port, + https_port => $https_port, + ssl_redirect => $ssl_redirect, + ssl_cert => $ssl_cert, + ssl_key => $ssl_key, + ssl_ca => $ssl_ca, + ssl_verify_client => $ssl_verify_client, + wsgi_processes => $wsgi_processes, + wsgi_threads => $wsgi_threads, + custom_wsgi_process_options => $custom_wsgi_process_options, + extra_params => $vhost_extra_params, + redirect_type => $redirect_type, + root_url => $root_url, + root_path => $root_path, + access_log_format => $access_log_format, } } diff --git a/releasenotes/notes/horizon-custom_wsgi_process_options-e11e7d92a9d631b1.yaml b/releasenotes/notes/horizon-custom_wsgi_process_options-e11e7d92a9d631b1.yaml new file mode 100644 index 00000000..d6e47575 --- /dev/null +++ b/releasenotes/notes/horizon-custom_wsgi_process_options-e11e7d92a9d631b1.yaml @@ -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. diff --git a/spec/classes/horizon_init_spec.rb b/spec/classes/horizon_init_spec.rb index 2c78cde3..68b741eb 100644 --- a/spec/classes/horizon_init_spec.rb +++ b/spec/classes/horizon_init_spec.rb @@ -35,12 +35,13 @@ describe 'horizon' do it 'configures apache' do is_expected.to contain_class('horizon::wsgi::apache').with({ - :servername => 'foo.example.com', - :listen_ssl => false, - :wsgi_processes => facts[:os_workers], - :wsgi_threads => '1', - :extra_params => {}, - :redirect_type => 'permanent', + :servername => 'foo.example.com', + :listen_ssl => false, + :wsgi_processes => facts[:os_workers], + :wsgi_threads => '1', + :custom_wsgi_process_options => {}, + :extra_params => {}, + :redirect_type => 'permanent', }) end @@ -408,15 +409,17 @@ describe 'horizon' do context 'with custom wsgi options' do before do - params.merge!( :wsgi_processes => '30', - :wsgi_threads => '5', - :access_log_format => 'common' ) + params.merge!( :wsgi_processes => '30', + :wsgi_threads => '5', + :custom_wsgi_process_options => { 'python-env' => '/tmp/test' }, + :access_log_format => 'common' ) end it { should contain_class('horizon::wsgi::apache').with( - :wsgi_processes => '30', - :wsgi_threads => '5', - :access_log_format => 'common', + :wsgi_processes => '30', + :wsgi_threads => '5', + :custom_wsgi_process_options => { 'python-env' => '/tmp/test' }, + :access_log_format => 'common', )} end