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: I2bcd2068f2d2968a63c29247d4e65815be33b176
This commit is contained in:
Benedikt Trefzer 2017-09-19 14:22:07 +02:00
parent 6ec650490c
commit dfeb00ade4
3 changed files with 73 additions and 52 deletions

View File

@ -70,6 +70,14 @@
# apache::vhost ssl parameters.
# Optional. 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['gnocchi']
@ -81,22 +89,23 @@
# class { 'gnocchi::wsgi::apache': }
#
class gnocchi::wsgi::apache (
$servername = $::fqdn,
$port = 8041,
$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',
$servername = $::fqdn,
$port = 8041,
$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',
$custom_wsgi_process_options = {},
) {
include ::gnocchi::deps
@ -108,28 +117,29 @@ class gnocchi::wsgi::apache (
}
::openstacklib::wsgi::apache { 'gnocchi_wsgi':
bind_host => $bind_host,
bind_port => $port,
group => 'gnocchi',
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 => 'gnocchi',
workers => $workers,
wsgi_daemon_process => 'gnocchi',
wsgi_process_display_name => $wsgi_process_display_name,
wsgi_process_group => 'gnocchi',
wsgi_script_dir => $::gnocchi::params::gnocchi_wsgi_script_path,
wsgi_script_file => 'app',
wsgi_script_source => $::gnocchi::params::gnocchi_wsgi_script_source,
bind_host => $bind_host,
bind_port => $port,
group => 'gnocchi',
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 => 'gnocchi',
workers => $workers,
wsgi_daemon_process => 'gnocchi',
wsgi_process_display_name => $wsgi_process_display_name,
wsgi_process_group => 'gnocchi',
wsgi_script_dir => $::gnocchi::params::gnocchi_wsgi_script_path,
wsgi_script_file => 'app',
wsgi_script_source => $::gnocchi::params::gnocchi_wsgi_script_source,
custom_wsgi_process_options => $custom_wsgi_process_options,
}
}

View File

@ -0,0 +1,4 @@
---
features:
- Add parameter to wsgi::apache to allow overwrite
and/or add additional wsgi process options.

View File

@ -9,19 +9,20 @@ describe 'gnocchi::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('gnocchi_wsgi').with(
:bind_port => 8041,
:group => 'gnocchi',
:path => '/',
:servername => facts[:fqdn],
:ssl => true,
:threads => 1,
:user => 'gnocchi',
:workers => facts[:os_workers],
:wsgi_daemon_process => 'gnocchi',
:wsgi_process_group => 'gnocchi',
:wsgi_script_dir => platform_params[:wsgi_script_path],
:wsgi_script_file => 'app',
:wsgi_script_source => platform_params[:wsgi_script_source],
:bind_port => 8041,
:group => 'gnocchi',
:path => '/',
:servername => facts[:fqdn],
:ssl => true,
:threads => 1,
:user => 'gnocchi',
:workers => facts[:os_workers],
:wsgi_daemon_process => 'gnocchi',
:wsgi_process_group => 'gnocchi',
: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
@ -35,6 +36,9 @@ describe 'gnocchi::wsgi::apache' do
:workers => 8,
:wsgi_process_display_name => 'gnocchi',
:threads => 2,
:custom_wsgi_process_options => {
'python_path' => '/my/python/path',
},
}
end
@ -58,6 +62,9 @@ describe 'gnocchi::wsgi::apache' do
: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