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. # apache::vhost ssl parameters.
# Optional. Default to apache::vhost 'ssl_*' defaults. # 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 # == Dependencies
# #
# requires Class['apache'] & Class['neutron'] # requires Class['apache'] & Class['neutron']
@@ -79,22 +87,23 @@
# class { 'neutron::wsgi::apache': } # class { 'neutron::wsgi::apache': }
# #
class neutron::wsgi::apache ( class neutron::wsgi::apache (
$servername = $::fqdn, $servername = $::fqdn,
$port = 9696, $port = 9696,
$bind_host = undef, $bind_host = undef,
$path = '/', $path = '/',
$ssl = true, $ssl = true,
$workers = $::os_workers, $workers = $::os_workers,
$ssl_cert = undef, $ssl_cert = undef,
$ssl_key = undef, $ssl_key = undef,
$ssl_chain = undef, $ssl_chain = undef,
$ssl_ca = undef, $ssl_ca = undef,
$ssl_crl_path = undef, $ssl_crl_path = undef,
$ssl_crl = undef, $ssl_crl = undef,
$ssl_certs_dir = undef, $ssl_certs_dir = undef,
$wsgi_process_display_name = undef, $wsgi_process_display_name = undef,
$threads = 1, $threads = 1,
$priority = '10', $priority = '10',
$custom_wsgi_process_options = {},
) { ) {
include ::neutron::deps include ::neutron::deps
@@ -126,28 +135,29 @@ class neutron::wsgi::apache (
~> Service['httpd'] ~> Service['httpd']
::openstacklib::wsgi::apache { 'neutron_wsgi': ::openstacklib::wsgi::apache { 'neutron_wsgi':
bind_host => $bind_host, bind_host => $bind_host,
bind_port => $port, bind_port => $port,
group => 'neutron', group => 'neutron',
path => $path, path => $path,
priority => $priority, priority => $priority,
servername => $servername, servername => $servername,
ssl => $ssl, ssl => $ssl,
ssl_ca => $ssl_ca, ssl_ca => $ssl_ca,
ssl_cert => $ssl_cert, ssl_cert => $ssl_cert,
ssl_certs_dir => $ssl_certs_dir, ssl_certs_dir => $ssl_certs_dir,
ssl_chain => $ssl_chain, ssl_chain => $ssl_chain,
ssl_crl => $ssl_crl, ssl_crl => $ssl_crl,
ssl_crl_path => $ssl_crl_path, ssl_crl_path => $ssl_crl_path,
ssl_key => $ssl_key, ssl_key => $ssl_key,
threads => $threads, threads => $threads,
user => 'neutron', user => 'neutron',
workers => $workers, workers => $workers,
wsgi_daemon_process => 'neutron', wsgi_daemon_process => 'neutron',
wsgi_process_display_name => $wsgi_process_display_name, wsgi_process_display_name => $wsgi_process_display_name,
wsgi_process_group => 'neutron', wsgi_process_group => 'neutron',
wsgi_script_dir => $::neutron::params::neutron_wsgi_script_path, wsgi_script_dir => $::neutron::params::neutron_wsgi_script_path,
wsgi_script_file => 'app', wsgi_script_file => 'app',
wsgi_script_source => $::neutron::params::neutron_wsgi_script_source, 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::wsgi') }
it { is_expected.to contain_class('apache::mod::ssl') } it { is_expected.to contain_class('apache::mod::ssl') }
it { is_expected.to contain_openstacklib__wsgi__apache('neutron_wsgi').with( it { is_expected.to contain_openstacklib__wsgi__apache('neutron_wsgi').with(
:bind_port => 9696, :bind_port => 9696,
:group => 'neutron', :group => 'neutron',
:path => '/', :path => '/',
:servername => facts[:fqdn], :servername => facts[:fqdn],
:ssl => true, :ssl => true,
:threads => 1, :threads => 1,
:user => 'neutron', :user => 'neutron',
:workers => facts[:os_workers], :workers => facts[:os_workers],
:wsgi_daemon_process => 'neutron', :wsgi_daemon_process => 'neutron',
:wsgi_process_group => 'neutron', :wsgi_process_group => 'neutron',
:wsgi_script_dir => platform_params[:wsgi_script_path], :wsgi_script_dir => platform_params[:wsgi_script_path],
:wsgi_script_file => 'app', :wsgi_script_file => 'app',
:wsgi_script_source => platform_params[:wsgi_script_source], :wsgi_script_source => platform_params[:wsgi_script_source],
:custom_wsgi_process_options => {},
)} )}
end end
@@ -34,6 +35,9 @@ describe 'neutron::wsgi::apache' do
:ssl => false, :ssl => false,
:wsgi_process_display_name => 'neutron', :wsgi_process_display_name => 'neutron',
:workers => 37, :workers => 37,
:custom_wsgi_process_options => {
'python_path' => '/my/python/path',
},
} }
end end
it { is_expected.to contain_class('neutron::params') } 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 contain_class('apache::mod::wsgi') }
it { is_expected.to_not contain_class('apache::mod::ssl') } it { is_expected.to_not contain_class('apache::mod::ssl') }
it { is_expected.to contain_openstacklib__wsgi__apache('neutron_wsgi').with( it { is_expected.to contain_openstacklib__wsgi__apache('neutron_wsgi').with(
:bind_host => '10.42.51.1', :bind_host => '10.42.51.1',
:bind_port => 12345, :bind_port => 12345,
:group => 'neutron', :group => 'neutron',
:path => '/', :path => '/',
:servername => 'dummy.host', :servername => 'dummy.host',
:ssl => false, :ssl => false,
:threads => 1, :threads => 1,
:user => 'neutron', :user => 'neutron',
:workers => 37, :workers => 37,
:wsgi_daemon_process => 'neutron', :wsgi_daemon_process => 'neutron',
:wsgi_process_display_name => 'neutron', :wsgi_process_display_name => 'neutron',
:wsgi_process_group => 'neutron', :wsgi_process_group => 'neutron',
:wsgi_script_dir => platform_params[:wsgi_script_path], :wsgi_script_dir => platform_params[:wsgi_script_path],
:wsgi_script_file => 'app', :wsgi_script_file => 'app',
:wsgi_script_source => platform_params[:wsgi_script_source], :wsgi_script_source => platform_params[:wsgi_script_source],
:custom_wsgi_process_options => {
'python_path' => '/my/python/path',
},
)} )}
end end
end end