diff --git a/manifests/wsgi/apache.pp b/manifests/wsgi/apache.pp index 3b9306b8..aebdf013 100644 --- a/manifests/wsgi/apache.pp +++ b/manifests/wsgi/apache.pp @@ -85,6 +85,14 @@ # The error log file name for the virtualhost. # Optional. Defaults to undef. # +# [*custom_wsgi_process_options*] +# (optional) gives you the oportunity 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 {} +# # == Dependencies # # requires Class['apache'] & Class['barbican'] @@ -104,25 +112,26 @@ # Copyright 2015 Red Hat Inc. # class barbican::wsgi::apache ( - $servername = $::fqdn, - $public_port = 9311, - $bind_host = undef, - $public_path = '/', - $ssl = true, - $workers = $::os_workers, - $ssl_cert = undef, - $ssl_key = undef, - $ssl_chain = undef, - $ssl_ca = undef, - $ssl_crl_path = undef, - $ssl_crl = undef, - $ssl_certs_dir = undef, - $wsgi_process_display_name = undef, - $threads = 1, - $priority = '10', - $access_log_file = false, - $access_log_format = false, - $error_log_file = undef, + $servername = $::fqdn, + $public_port = 9311, + $bind_host = undef, + $public_path = '/', + $ssl = true, + $workers = $::os_workers, + $ssl_cert = undef, + $ssl_key = undef, + $ssl_chain = undef, + $ssl_ca = undef, + $ssl_crl_path = undef, + $ssl_crl = undef, + $ssl_certs_dir = undef, + $wsgi_process_display_name = undef, + $threads = 1, + $priority = '10', + $access_log_file = false, + $access_log_format = false, + $error_log_file = undef, + $custom_wsgi_process_options = {}, ) { include ::barbican::deps @@ -154,31 +163,32 @@ class barbican::wsgi::apache ( File[$::barbican::params::httpd_config_file] ~> Service['httpd'] ::openstacklib::wsgi::apache { 'barbican_wsgi_main': - bind_host => $bind_host, - bind_port => $public_port, - group => 'barbican', - path => $public_path, - priority => $priority, - servername => $servername, - ssl => $ssl, - ssl_ca => $ssl_ca, - ssl_cert => $ssl_cert, - ssl_certs_dir => $ssl_certs_dir, - ssl_chain => $ssl_chain, - ssl_crl => $ssl_crl, - ssl_crl_path => $ssl_crl_path, - ssl_key => $ssl_key, - threads => $threads, - user => 'barbican', - workers => $workers, - wsgi_daemon_process => 'barbican-api', - wsgi_process_display_name => $wsgi_process_display_name, - wsgi_process_group => 'barbican-api', - wsgi_script_dir => $::barbican::params::barbican_wsgi_script_path, - wsgi_script_file => 'main', - wsgi_script_source => $::barbican::params::barbican_wsgi_script_source, - access_log_file => $access_log_file, - access_log_format => $access_log_format, - error_log_file => $error_log_file, + bind_host => $bind_host, + bind_port => $public_port, + group => 'barbican', + path => $public_path, + priority => $priority, + servername => $servername, + ssl => $ssl, + ssl_ca => $ssl_ca, + ssl_cert => $ssl_cert, + ssl_certs_dir => $ssl_certs_dir, + ssl_chain => $ssl_chain, + ssl_crl => $ssl_crl, + ssl_crl_path => $ssl_crl_path, + ssl_key => $ssl_key, + threads => $threads, + user => 'barbican', + workers => $workers, + wsgi_daemon_process => 'barbican-api', + wsgi_process_display_name => $wsgi_process_display_name, + wsgi_process_group => 'barbican-api', + wsgi_script_dir => $::barbican::params::barbican_wsgi_script_path, + wsgi_script_file => 'main', + wsgi_script_source => $::barbican::params::barbican_wsgi_script_source, + access_log_file => $access_log_file, + access_log_format => $access_log_format, + error_log_file => $error_log_file, + custom_wsgi_process_options => $custom_wsgi_process_options, } } diff --git a/releasenotes/notes/wsgi_process_options-82e2ad99fc73445b.yaml b/releasenotes/notes/wsgi_process_options-82e2ad99fc73445b.yaml new file mode 100644 index 00000000..22d5cd14 --- /dev/null +++ b/releasenotes/notes/wsgi_process_options-82e2ad99fc73445b.yaml @@ -0,0 +1,4 @@ +--- +features: + - Add parameter to apache_wsgi to allow overwrite + and/or add additional wsgi process options. diff --git a/spec/classes/barbican_wsgi_apache_spec.rb b/spec/classes/barbican_wsgi_apache_spec.rb index e66e26de..c0f6e3ac 100644 --- a/spec/classes/barbican_wsgi_apache_spec.rb +++ b/spec/classes/barbican_wsgi_apache_spec.rb @@ -28,36 +28,40 @@ describe 'barbican::wsgi::apache' do it { is_expected.to contain_class('apache::mod::wsgi') } it { is_expected.to contain_class('apache::mod::ssl') } it { is_expected.to contain_openstacklib__wsgi__apache('barbican_wsgi_main').with( - :bind_port => 9311, - :group => 'barbican', - :path => '/', - :servername => facts[:fqdn], - :ssl => true, - :threads => 1, - :user => 'barbican', - :workers => facts[:os_workers], - :wsgi_daemon_process => 'barbican-api', - :wsgi_process_group => 'barbican-api', - :wsgi_script_dir => platform_params[:wsgi_script_path], - :wsgi_script_file => 'main', - :wsgi_script_source => platform_params[:wsgi_script_source], - :access_log_file => false, - :access_log_format => false, + :bind_port => 9311, + :group => 'barbican', + :path => '/', + :servername => facts[:fqdn], + :ssl => true, + :threads => 1, + :user => 'barbican', + :workers => facts[:os_workers], + :wsgi_daemon_process => 'barbican-api', + :wsgi_process_group => 'barbican-api', + :wsgi_script_dir => platform_params[:wsgi_script_path], + :wsgi_script_file => 'main', + :wsgi_script_source => platform_params[:wsgi_script_source], + :access_log_file => false, + :access_log_format => false, + :custom_wsgi_process_options => {}, )} end context 'when overriding parameters using different ports' do let :params do { - :servername => 'dummy.host', - :bind_host => '10.42.51.1', - :public_port => 12345, - :ssl => false, - :wsgi_process_display_name => 'barbican-api', - :workers => 37, - :access_log_file => '/var/log/httpd/access_log', - :access_log_format => 'some format', - :error_log_file => '/var/log/httpd/error_log' + :servername => 'dummy.host', + :bind_host => '10.42.51.1', + :public_port => 12345, + :ssl => false, + :wsgi_process_display_name => 'barbican-api', + :workers => 37, + :access_log_file => '/var/log/httpd/access_log', + :access_log_format => 'some format', + :error_log_file => '/var/log/httpd/error_log', + :custom_wsgi_process_options => { + 'python_path' => '/my/python/path', + }, } end it { is_expected.to contain_class('barbican::params') } @@ -65,24 +69,27 @@ describe 'barbican::wsgi::apache' do it { is_expected.to contain_class('apache::mod::wsgi') } it { is_expected.to_not contain_class('apache::mod::ssl') } it { is_expected.to contain_openstacklib__wsgi__apache('barbican_wsgi_main').with( - :bind_host => '10.42.51.1', - :bind_port => 12345, - :group => 'barbican', - :path => '/', - :servername => 'dummy.host', - :ssl => false, - :threads => 1, - :user => 'barbican', - :workers => 37, - :wsgi_daemon_process => 'barbican-api', - :wsgi_process_display_name => 'barbican-api', - :wsgi_process_group => 'barbican-api', - :wsgi_script_dir => platform_params[:wsgi_script_path], - :wsgi_script_file => 'main', - :wsgi_script_source => platform_params[:wsgi_script_source], - :access_log_file => '/var/log/httpd/access_log', - :access_log_format => 'some format', - :error_log_file => '/var/log/httpd/error_log' + :bind_host => '10.42.51.1', + :bind_port => 12345, + :group => 'barbican', + :path => '/', + :servername => 'dummy.host', + :ssl => false, + :threads => 1, + :user => 'barbican', + :workers => 37, + :wsgi_daemon_process => 'barbican-api', + :wsgi_process_display_name => 'barbican-api', + :wsgi_process_group => 'barbican-api', + :wsgi_script_dir => platform_params[:wsgi_script_path], + :wsgi_script_file => 'main', + :wsgi_script_source => platform_params[:wsgi_script_source], + :access_log_file => '/var/log/httpd/access_log', + :access_log_format => 'some format', + :error_log_file => '/var/log/httpd/error_log', + :custom_wsgi_process_options => { + 'python_path' => '/my/python/path', + }, )} end end