From 516107376678dfba18a43f34be35800b3fee7be6 Mon Sep 17 00:00:00 2001 From: ZhongShengping Date: Mon, 23 Oct 2017 13:56:27 +0800 Subject: [PATCH] add parameter to overwrite/add wsgi process options Add parameter to apache_wsgi to allow overwrite and/or add additional wsgi process options. This possibility was added to openstacklib with Change-Id: I41914ce3361988d5db1695f09d21209772fdf548 lease enter the commit message for your changes. Lines starting Change-Id: I81620b1ee5b4167c819f96474459e3af4770913c --- manifests/wsgi/apache.pp | 100 ++++++++++-------- ...wsgi_process_options-b01aa3d1442febfe.yaml | 4 + spec/classes/ironic_wsgi_apache_spec.rb | 91 ++++++++-------- 3 files changed, 108 insertions(+), 87 deletions(-) create mode 100644 releasenotes/notes/wsgi_process_options-b01aa3d1442febfe.yaml diff --git a/manifests/wsgi/apache.pp b/manifests/wsgi/apache.pp index bf97839d..976b07de 100644 --- a/manifests/wsgi/apache.pp +++ b/manifests/wsgi/apache.pp @@ -78,6 +78,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['ironic'] @@ -90,25 +98,26 @@ # class ironic::wsgi::apache ( - $servername = $::fqdn, - $port = 6385, - $bind_host = undef, - $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, + $port = 6385, + $bind_host = undef, + $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 ::ironic::deps @@ -120,31 +129,32 @@ class ironic::wsgi::apache ( } ::openstacklib::wsgi::apache { 'ironic_wsgi': - bind_host => $bind_host, - bind_port => $port, - group => 'ironic', - path => $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 => 'ironic', - workers => $workers, - wsgi_daemon_process => 'ironic', - wsgi_process_display_name => $wsgi_process_display_name, - wsgi_process_group => 'ironic', - wsgi_script_dir => $::ironic::params::ironic_wsgi_script_path, - wsgi_script_file => 'app', - wsgi_script_source => $::ironic::params::ironic_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 => $port, + group => 'ironic', + path => $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 => 'ironic', + workers => $workers, + wsgi_daemon_process => 'ironic', + wsgi_process_display_name => $wsgi_process_display_name, + wsgi_process_group => 'ironic', + wsgi_script_dir => $::ironic::params::ironic_wsgi_script_path, + wsgi_script_file => 'app', + wsgi_script_source => $::ironic::params::ironic_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-b01aa3d1442febfe.yaml b/releasenotes/notes/wsgi_process_options-b01aa3d1442febfe.yaml new file mode 100644 index 00000000..22d5cd14 --- /dev/null +++ b/releasenotes/notes/wsgi_process_options-b01aa3d1442febfe.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/ironic_wsgi_apache_spec.rb b/spec/classes/ironic_wsgi_apache_spec.rb index 98c32e51..ed2b118a 100644 --- a/spec/classes/ironic_wsgi_apache_spec.rb +++ b/spec/classes/ironic_wsgi_apache_spec.rb @@ -9,36 +9,40 @@ describe 'ironic::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('ironic_wsgi').with( - :bind_port => 6385, - :group => 'ironic', - :path => '/', - :servername => facts[:fqdn], - :ssl => true, - :threads => 1, - :user => 'ironic', - :workers => facts[:os_workers], - :wsgi_daemon_process => 'ironic', - :wsgi_process_group => 'ironic', - :wsgi_script_dir => platform_params[:wsgi_script_path], - :wsgi_script_file => 'app', - :wsgi_script_source => platform_params[:wsgi_script_source], - :access_log_file => false, - :access_log_format => false, + :bind_port => 6385, + :group => 'ironic', + :path => '/', + :servername => facts[:fqdn], + :ssl => true, + :threads => 1, + :user => 'ironic', + :workers => facts[:os_workers], + :wsgi_daemon_process => 'ironic', + :wsgi_process_group => 'ironic', + :wsgi_script_dir => platform_params[:wsgi_script_path], + :wsgi_script_file => 'app', + :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', - :port => 12345, - :ssl => false, - :wsgi_process_display_name => 'ironic', - :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', + :port => 12345, + :ssl => false, + :wsgi_process_display_name => 'ironic', + :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('ironic::params') } @@ -46,24 +50,27 @@ describe 'ironic::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('ironic_wsgi').with( - :bind_host => '10.42.51.1', - :bind_port => 12345, - :group => 'ironic', - :path => '/', - :servername => 'dummy.host', - :ssl => false, - :threads => 1, - :user => 'ironic', - :workers => 37, - :wsgi_daemon_process => 'ironic', - :wsgi_process_display_name => 'ironic', - :wsgi_process_group => 'ironic', - :wsgi_script_dir => platform_params[:wsgi_script_path], - :wsgi_script_file => 'app', - :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 => 'ironic', + :path => '/', + :servername => 'dummy.host', + :ssl => false, + :threads => 1, + :user => 'ironic', + :workers => 37, + :wsgi_daemon_process => 'ironic', + :wsgi_process_display_name => 'ironic', + :wsgi_process_group => 'ironic', + :wsgi_script_dir => platform_params[:wsgi_script_path], + :wsgi_script_file => 'app', + :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