From 560b82e9ae36d52f8eaca2e07d5d6ba58c61a3dc Mon Sep 17 00:00:00 2001 From: Benedikt Trefzer <benedikt.trefzer@cirrax.com> Date: Mon, 18 Sep 2017 10:51:30 +0200 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 Change-Id: I1a2f1a28200d362b7918a458e8f885873062e98b --- manifests/wsgi/apache.pp | 88 +++++++++++-------- ...wsgi_process_options-6ff05b70409dc49e.yaml | 4 + spec/classes/ceilometer_wsgi_apache_spec.rb | 63 +++++++------ 3 files changed, 88 insertions(+), 67 deletions(-) create mode 100644 releasenotes/notes/wsgi_process_options-6ff05b70409dc49e.yaml diff --git a/manifests/wsgi/apache.pp b/manifests/wsgi/apache.pp index 374cbf5f..a5969126 100644 --- a/manifests/wsgi/apache.pp +++ b/manifests/wsgi/apache.pp @@ -72,6 +72,14 @@ # (Optional) apache::vhost ssl parameters. # Default to apache::vhost 'ssl_*' defaults. # +# [*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['ceilometer'] @@ -83,22 +91,23 @@ # class { 'ceilometer::wsgi::apache': } # class ceilometer::wsgi::apache ( - $servername = $::fqdn, - $port = 8777, - $bind_host = undef, - $path = '/', - $ssl = true, - $workers = 1, - $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 = $::os_workers, - $priority = '10', + $servername = $::fqdn, + $port = 8777, + $bind_host = undef, + $path = '/', + $ssl = true, + $workers = 1, + $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 = $::os_workers, + $priority = '10', + $custom_wsgi_process_options = {}, ) { include ::ceilometer::deps @@ -114,28 +123,29 @@ class ceilometer::wsgi::apache ( Anchor['ceilometer::install::end'] -> Class['apache'] ::openstacklib::wsgi::apache { 'ceilometer_wsgi': - bind_host => $bind_host, - bind_port => $port, - group => 'ceilometer', - 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 => 'ceilometer', - workers => $workers, - wsgi_daemon_process => 'ceilometer', - wsgi_process_display_name => $wsgi_process_display_name, - wsgi_process_group => 'ceilometer', - wsgi_script_dir => $::ceilometer::params::ceilometer_wsgi_script_path, - wsgi_script_file => 'app', - wsgi_script_source => $::ceilometer::params::ceilometer_wsgi_script_source, + bind_host => $bind_host, + bind_port => $port, + group => 'ceilometer', + 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 => 'ceilometer', + workers => $workers, + wsgi_daemon_process => 'ceilometer', + wsgi_process_display_name => $wsgi_process_display_name, + wsgi_process_group => 'ceilometer', + wsgi_script_dir => $::ceilometer::params::ceilometer_wsgi_script_path, + wsgi_script_file => 'app', + wsgi_script_source => $::ceilometer::params::ceilometer_wsgi_script_source, + custom_wsgi_process_options => $custom_wsgi_process_options, } } diff --git a/releasenotes/notes/wsgi_process_options-6ff05b70409dc49e.yaml b/releasenotes/notes/wsgi_process_options-6ff05b70409dc49e.yaml new file mode 100644 index 00000000..2ad68c68 --- /dev/null +++ b/releasenotes/notes/wsgi_process_options-6ff05b70409dc49e.yaml @@ -0,0 +1,4 @@ +--- +features: + - Add parameter to apacher_wsgi to allow overwrite + and/or add additional wsgi process options. diff --git a/spec/classes/ceilometer_wsgi_apache_spec.rb b/spec/classes/ceilometer_wsgi_apache_spec.rb index 5f7f202e..3de45bea 100644 --- a/spec/classes/ceilometer_wsgi_apache_spec.rb +++ b/spec/classes/ceilometer_wsgi_apache_spec.rb @@ -13,19 +13,20 @@ describe 'ceilometer::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('ceilometer_wsgi').with( - :bind_port => 8777, - :group => 'ceilometer', - :path => '/', - :servername => facts[:fqdn], - :ssl => true, - :threads => facts[:os_workers], - :user => 'ceilometer', - :workers => 1, - :wsgi_daemon_process => 'ceilometer', - :wsgi_process_group => 'ceilometer', - :wsgi_script_dir => platform_params[:wsgi_script_path], - :wsgi_script_file => 'app', - :wsgi_script_source => platform_params[:wsgi_script_source], + :bind_port => 8777, + :group => 'ceilometer', + :path => '/', + :servername => facts[:fqdn], + :ssl => true, + :threads => facts[:os_workers], + :user => 'ceilometer', + :workers => 1, + :wsgi_daemon_process => 'ceilometer', + :wsgi_process_group => 'ceilometer', + :wsgi_script_dir => platform_params[:wsgi_script_path], + :wsgi_script_file => 'app', + :wsgi_script_source => platform_params[:wsgi_script_source], + :custom_wsgi_process_options => {}, )} end @@ -38,6 +39,9 @@ describe 'ceilometer::wsgi::apache' do :ssl => false, :wsgi_process_display_name => 'ceilometer', :workers => 37, + :custom_wsgi_process_options => { + 'python_path' => '/my/python/path', + }, } end it { is_expected.to contain_class('ceilometer::deps') } @@ -46,21 +50,24 @@ describe 'ceilometer::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('ceilometer_wsgi').with( - :bind_host => '10.42.51.1', - :bind_port => 12345, - :group => 'ceilometer', - :path => '/', - :servername => 'dummy.host', - :ssl => false, - :threads => facts[:os_workers], - :user => 'ceilometer', - :workers => 37, - :wsgi_daemon_process => 'ceilometer', - :wsgi_process_display_name => 'ceilometer', - :wsgi_process_group => 'ceilometer', - :wsgi_script_dir => platform_params[:wsgi_script_path], - :wsgi_script_file => 'app', - :wsgi_script_source => platform_params[:wsgi_script_source], + :bind_host => '10.42.51.1', + :bind_port => 12345, + :group => 'ceilometer', + :path => '/', + :servername => 'dummy.host', + :ssl => false, + :threads => facts[:os_workers], + :user => 'ceilometer', + :workers => 37, + :wsgi_daemon_process => 'ceilometer', + :wsgi_process_display_name => 'ceilometer', + :wsgi_process_group => 'ceilometer', + :wsgi_script_dir => platform_params[:wsgi_script_path], + :wsgi_script_file => 'app', + :wsgi_script_source => platform_params[:wsgi_script_source], + :custom_wsgi_process_options => { + 'python_path' => '/my/python/path', + }, )} end end