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: I8b816cbe861ba315018505973dfbb72088bc9b2a
This commit is contained in:
Benedikt Trefzer 2017-09-18 11:22:33 +02:00
parent 1a8b6e1816
commit c1465f8fa6
3 changed files with 88 additions and 67 deletions

View File

@ -68,6 +68,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['neutron']
@ -79,22 +87,23 @@
# class { 'neutron::wsgi::apache': }
#
class neutron::wsgi::apache (
$servername = $::fqdn,
$port = 9696,
$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 = 9696,
$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 ::neutron::deps
@ -126,28 +135,29 @@ class neutron::wsgi::apache (
~> Service['httpd']
::openstacklib::wsgi::apache { 'neutron_wsgi':
bind_host => $bind_host,
bind_port => $port,
group => 'neutron',
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 => 'neutron',
workers => $workers,
wsgi_daemon_process => 'neutron',
wsgi_process_display_name => $wsgi_process_display_name,
wsgi_process_group => 'neutron',
wsgi_script_dir => $::neutron::params::neutron_wsgi_script_path,
wsgi_script_file => 'app',
wsgi_script_source => $::neutron::params::neutron_wsgi_script_source,
bind_host => $bind_host,
bind_port => $port,
group => 'neutron',
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 => 'neutron',
workers => $workers,
wsgi_daemon_process => 'neutron',
wsgi_process_display_name => $wsgi_process_display_name,
wsgi_process_group => 'neutron',
wsgi_script_dir => $::neutron::params::neutron_wsgi_script_path,
wsgi_script_file => 'app',
wsgi_script_source => $::neutron::params::neutron_wsgi_script_source,
custom_wsgi_process_options => $custom_wsgi_process_options,
}
}

View File

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

View File

@ -9,19 +9,20 @@ describe 'neutron::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('neutron_wsgi').with(
:bind_port => 9696,
:group => 'neutron',
:path => '/',
:servername => facts[:fqdn],
:ssl => true,
:threads => 1,
:user => 'neutron',
:workers => facts[:os_workers],
:wsgi_daemon_process => 'neutron',
:wsgi_process_group => 'neutron',
:wsgi_script_dir => platform_params[:wsgi_script_path],
:wsgi_script_file => 'app',
:wsgi_script_source => platform_params[:wsgi_script_source],
:bind_port => 9696,
:group => 'neutron',
:path => '/',
:servername => facts[:fqdn],
:ssl => true,
:threads => 1,
:user => 'neutron',
:workers => facts[:os_workers],
:wsgi_daemon_process => 'neutron',
:wsgi_process_group => 'neutron',
: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
@ -34,6 +35,9 @@ describe 'neutron::wsgi::apache' do
:ssl => false,
:wsgi_process_display_name => 'neutron',
:workers => 37,
:custom_wsgi_process_options => {
'python_path' => '/my/python/path',
},
}
end
it { is_expected.to contain_class('neutron::params') }
@ -41,21 +45,24 @@ describe 'neutron::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('neutron_wsgi').with(
:bind_host => '10.42.51.1',
:bind_port => 12345,
:group => 'neutron',
:path => '/',
:servername => 'dummy.host',
:ssl => false,
:threads => 1,
:user => 'neutron',
:workers => 37,
:wsgi_daemon_process => 'neutron',
:wsgi_process_display_name => 'neutron',
:wsgi_process_group => 'neutron',
: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 => 'neutron',
:path => '/',
:servername => 'dummy.host',
:ssl => false,
:threads => 1,
:user => 'neutron',
:workers => 37,
:wsgi_daemon_process => 'neutron',
:wsgi_process_display_name => 'neutron',
:wsgi_process_group => 'neutron',
: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