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: I1d50ee01ebfdfaeb2ac02bc5b944f5b996cbc2db
(cherry picked from commit 1584887d9d)
This commit is contained in:
Benedikt Trefzer 2017-09-18 11:41:23 +02:00 committed by zhongshengping
parent 048b327668
commit fd7985d212
5 changed files with 179 additions and 141 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['nova'] & Class['nova::api']
@ -81,22 +89,23 @@
# class { 'nova::wsgi::apache': }
#
class nova::wsgi::apache_api (
$servername = $::fqdn,
$api_port = 8774,
$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,
$api_port = 8774,
$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 ::nova::params
@ -111,29 +120,30 @@ class nova::wsgi::apache_api (
}
::openstacklib::wsgi::apache { 'nova_api_wsgi':
bind_host => $bind_host,
bind_port => $api_port,
group => 'nova',
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 => 'nova',
workers => $workers,
wsgi_daemon_process => 'nova-api',
wsgi_process_display_name => $wsgi_process_display_name,
wsgi_process_group => 'nova-api',
wsgi_script_dir => $::nova::params::nova_wsgi_script_path,
wsgi_script_file => 'nova-api',
wsgi_script_source => $::nova::params::nova_api_wsgi_script_source,
bind_host => $bind_host,
bind_port => $api_port,
group => 'nova',
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 => 'nova',
workers => $workers,
wsgi_daemon_process => 'nova-api',
wsgi_process_display_name => $wsgi_process_display_name,
wsgi_process_group => 'nova-api',
wsgi_script_dir => $::nova::params::nova_wsgi_script_path,
wsgi_script_file => 'nova-api',
wsgi_script_source => $::nova::params::nova_api_wsgi_script_source,
custom_wsgi_process_options => $custom_wsgi_process_options,
}
}

View File

@ -72,6 +72,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 {}
#
# == Examples
#
# include apache
@ -79,23 +87,24 @@
# class { 'nova::wsgi::apache': }
#
class nova::wsgi::apache_placement (
$servername = $::fqdn,
$api_port = 80,
$bind_host = undef,
$path = '/placement',
$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',
$ensure_package = 'present',
$servername = $::fqdn,
$api_port = 80,
$bind_host = undef,
$path = '/placement',
$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',
$ensure_package = 'present',
$custom_wsgi_process_options = {},
) {
include ::nova::params
@ -127,29 +136,30 @@ class nova::wsgi::apache_placement (
~> Service['httpd']
::openstacklib::wsgi::apache { 'placement_wsgi':
bind_host => $bind_host,
bind_port => $api_port,
group => 'nova',
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 => 'nova',
workers => $workers,
wsgi_daemon_process => 'placement-api',
wsgi_process_display_name => $wsgi_process_display_name,
wsgi_process_group => 'placement-api',
wsgi_script_dir => $::nova::params::nova_wsgi_script_path,
wsgi_script_file => 'nova-placement-api',
wsgi_script_source => $::nova::params::placement_wsgi_script_source,
bind_host => $bind_host,
bind_port => $api_port,
group => 'nova',
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 => 'nova',
workers => $workers,
wsgi_daemon_process => 'placement-api',
wsgi_process_display_name => $wsgi_process_display_name,
wsgi_process_group => 'placement-api',
wsgi_script_dir => $::nova::params::nova_wsgi_script_path,
wsgi_script_file => 'nova-placement-api',
wsgi_script_source => $::nova::params::placement_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

@ -18,19 +18,20 @@ describe 'nova::wsgi::apache_api' 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('nova_api_wsgi').with(
:bind_port => 8774,
:group => 'nova',
:path => '/',
:servername => facts[:fqdn],
:ssl => true,
:threads => facts[:os_workers],
:user => 'nova',
:workers => 1,
:wsgi_daemon_process => 'nova-api',
:wsgi_process_group => 'nova-api',
:wsgi_script_dir => platform_params[:wsgi_script_path],
:wsgi_script_file => 'nova-api',
:wsgi_script_source => platform_params[:api_wsgi_script_source],
:bind_port => 8774,
:group => 'nova',
:path => '/',
:servername => facts[:fqdn],
:ssl => true,
:threads => facts[:os_workers],
:user => 'nova',
:workers => 1,
:wsgi_daemon_process => 'nova-api',
:wsgi_process_group => 'nova-api',
:wsgi_script_dir => platform_params[:wsgi_script_path],
:wsgi_script_file => 'nova-api',
:wsgi_script_source => platform_params[:api_wsgi_script_source],
:custom_wsgi_process_options => {},
)}
end
@ -47,12 +48,15 @@ describe 'nova::wsgi::apache_api' do
let :params do
{
:servername => 'dummy.host',
:bind_host => '10.42.51.1',
:api_port => 12345,
:ssl => false,
:wsgi_process_display_name => 'nova-api',
:workers => 37,
:servername => 'dummy.host',
:bind_host => '10.42.51.1',
:api_port => 12345,
:ssl => false,
:wsgi_process_display_name => 'nova-api',
:workers => 37,
:custom_wsgi_process_options => {
'python_path' => '/my/python/path',
},
}
end
@ -61,21 +65,24 @@ describe 'nova::wsgi::apache_api' 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('nova_api_wsgi').with(
:bind_host => '10.42.51.1',
:bind_port => 12345,
:group => 'nova',
:path => '/',
:servername => 'dummy.host',
:ssl => false,
:threads => facts[:os_workers],
:user => 'nova',
:workers => 37,
:wsgi_daemon_process => 'nova-api',
:wsgi_process_display_name => 'nova-api',
:wsgi_process_group => 'nova-api',
:wsgi_script_dir => platform_params[:wsgi_script_path],
:wsgi_script_file => 'nova-api',
:wsgi_script_source => platform_params[:api_wsgi_script_source],
:bind_host => '10.42.51.1',
:bind_port => 12345,
:group => 'nova',
:path => '/',
:servername => 'dummy.host',
:ssl => false,
:threads => facts[:os_workers],
:user => 'nova',
:workers => 37,
:wsgi_daemon_process => 'nova-api',
:wsgi_process_display_name => 'nova-api',
:wsgi_process_group => 'nova-api',
:wsgi_script_dir => platform_params[:wsgi_script_path],
:wsgi_script_file => 'nova-api',
:wsgi_script_source => platform_params[:api_wsgi_script_source],
:custom_wsgi_process_options => {
'python_path' => '/my/python/path',
},
)}
end

View File

@ -23,19 +23,20 @@ describe 'nova::wsgi::apache_placement' do
)}
it { is_expected.to contain_file(platform_params[:placement_httpd_config_file]) }
it { is_expected.to contain_openstacklib__wsgi__apache('placement_wsgi').with(
:bind_port => 80,
:group => 'nova',
:path => '/placement',
:servername => facts[:fqdn],
:ssl => true,
:threads => facts[:os_workers],
:user => 'nova',
:workers => 1,
:wsgi_daemon_process => 'placement-api',
:wsgi_process_group => 'placement-api',
:wsgi_script_dir => platform_params[:wsgi_script_path],
:wsgi_script_file => 'nova-placement-api',
:wsgi_script_source => platform_params[:placement_wsgi_script_source],
:bind_port => 80,
:group => 'nova',
:path => '/placement',
:servername => facts[:fqdn],
:ssl => true,
:threads => facts[:os_workers],
:user => 'nova',
:workers => 1,
:wsgi_daemon_process => 'placement-api',
:wsgi_process_group => 'placement-api',
:wsgi_script_dir => platform_params[:wsgi_script_path],
:wsgi_script_file => 'nova-placement-api',
:wsgi_script_source => platform_params[:placement_wsgi_script_source],
:custom_wsgi_process_options => {},
)}
end
@ -57,6 +58,9 @@ describe 'nova::wsgi::apache_placement' do
:ssl => false,
:wsgi_process_display_name => 'placement-api',
:workers => 37,
:custom_wsgi_process_options => {
'python_path' => '/my/python/path',
},
}
end
@ -71,21 +75,24 @@ describe 'nova::wsgi::apache_placement' do
)}
it { is_expected.to contain_file(platform_params[:placement_httpd_config_file]) }
it { is_expected.to contain_openstacklib__wsgi__apache('placement_wsgi').with(
:bind_host => '10.42.51.1',
:bind_port => 12345,
:group => 'nova',
:path => '/placement',
:servername => 'dummy.host',
:ssl => false,
:workers => 37,
:threads => facts[:os_workers],
:user => 'nova',
:wsgi_daemon_process => 'placement-api',
:wsgi_process_display_name => 'placement-api',
:wsgi_process_group => 'placement-api',
:wsgi_script_dir => platform_params[:wsgi_script_path],
:wsgi_script_file => 'nova-placement-api',
:wsgi_script_source => platform_params[:placement_wsgi_script_source],
:bind_host => '10.42.51.1',
:bind_port => 12345,
:group => 'nova',
:path => '/placement',
:servername => 'dummy.host',
:ssl => false,
:workers => 37,
:threads => facts[:os_workers],
:user => 'nova',
:wsgi_daemon_process => 'placement-api',
:wsgi_process_display_name => 'placement-api',
:wsgi_process_group => 'placement-api',
:wsgi_script_dir => platform_params[:wsgi_script_path],
:wsgi_script_file => 'nova-placement-api',
:wsgi_script_source => platform_params[:placement_wsgi_script_source],
:custom_wsgi_process_options => {
'python_path' => '/my/python/path',
},
)}
end
end