Merge "add parameter to overwrite/add wsgi process options"

This commit is contained in:
Jenkins 2017-09-07 15:15:01 +00:00 committed by Gerrit Code Review
commit 01128fe45d
3 changed files with 80 additions and 59 deletions

View File

@ -66,6 +66,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['cinder']
@ -77,22 +85,23 @@
# class { 'cinder::wsgi::apache': }
#
class cinder::wsgi::apache (
$servername = $::fqdn,
$port = 8776,
$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 = 8776,
$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 ::cinder::deps
@ -104,29 +113,30 @@ class cinder::wsgi::apache (
}
::openstacklib::wsgi::apache { 'cinder_wsgi':
bind_host => $bind_host,
bind_port => $port,
group => 'cinder',
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 => 'cinder',
workers => $workers,
wsgi_daemon_process => 'cinder-api',
wsgi_process_display_name => $wsgi_process_display_name,
wsgi_process_group => 'cinder-api',
wsgi_script_dir => $::cinder::params::cinder_wsgi_script_path,
wsgi_script_file => 'cinder-api',
wsgi_script_source => $::cinder::params::cinder_wsgi_script_source,
require => Anchor['cinder::install::end'],
bind_host => $bind_host,
bind_port => $port,
group => 'cinder',
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 => 'cinder',
workers => $workers,
wsgi_daemon_process => 'cinder-api',
wsgi_process_display_name => $wsgi_process_display_name,
wsgi_process_group => 'cinder-api',
wsgi_script_dir => $::cinder::params::cinder_wsgi_script_path,
wsgi_script_file => 'cinder-api',
wsgi_script_source => $::cinder::params::cinder_wsgi_script_source,
custom_wsgi_process_options => $custom_wsgi_process_options,
require => Anchor['cinder::install::end'],
}
}

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,31 +9,35 @@ describe 'cinder::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('cinder_wsgi').with(
:bind_port => 8776,
:group => 'cinder',
:path => '/',
:servername => facts[:fqdn],
:ssl => true,
:threads => facts[:os_workers],
:user => 'cinder',
:workers => 1,
:wsgi_daemon_process => 'cinder-api',
:wsgi_process_group => 'cinder-api',
:wsgi_script_dir => platform_params[:wsgi_script_path],
:wsgi_script_file => 'cinder-api',
:wsgi_script_source => platform_params[:wsgi_script_source],
:bind_port => 8776,
:group => 'cinder',
:path => '/',
:servername => facts[:fqdn],
:ssl => true,
:threads => facts[:os_workers],
:user => 'cinder',
:workers => 1,
:wsgi_daemon_process => 'cinder-api',
:wsgi_process_group => 'cinder-api',
:wsgi_script_dir => platform_params[:wsgi_script_path],
:wsgi_script_file => 'cinder-api',
:wsgi_script_source => platform_params[:wsgi_script_source],
: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 => 'cinder-api',
:workers => 37,
:servername => 'dummy.host',
:bind_host => '10.42.51.1',
:port => 12345,
:ssl => false,
:wsgi_process_display_name => 'cinder-api',
:workers => 37,
:custom_wsgi_process_options => {
'python_path' => '/my/python/admin/path',
},
}
end
it { is_expected.to contain_class('cinder::params') }
@ -56,6 +60,9 @@ describe 'cinder::wsgi::apache' do
:wsgi_script_dir => platform_params[:wsgi_script_path],
:wsgi_script_file => 'cinder-api',
:wsgi_script_source => platform_params[:wsgi_script_source],
:custom_wsgi_process_options => {
'python_path' => '/my/python/admin/path',
},
)}
end
end