Allow wsgi script to be configurable

Change-Id: Ie2a6fa3113c1e0a97f73e8e4d750e19003a18f06
This commit is contained in:
Adrian Smith
2020-03-20 15:54:19 +11:00
parent dabda38321
commit 1c7c146c91
3 changed files with 26 additions and 5 deletions

View File

@@ -90,6 +90,14 @@
# { python-path => '/my/python/virtualenv' } # { python-path => '/my/python/virtualenv' }
# Defaults to {} # Defaults to {}
# #
# [*wsgi_script_dir*]
# (optional) The directory to install the WSGI script for apache to read
# Optional. Defaults to $::aodh::params::aodh_wsgi_script_path
#
# [*wsgi_script_source*]
# (optional) The location of the aodh WSGI script
# Optional. Defaults to $::aodh::params::aodh_wsgi_script_source
#
# #
# == Dependencies # == Dependencies
# #
@@ -122,6 +130,8 @@ class aodh::wsgi::apache (
$access_log_format = false, $access_log_format = false,
$error_log_file = undef, $error_log_file = undef,
$custom_wsgi_process_options = {}, $custom_wsgi_process_options = {},
$wsgi_script_dir = undef,
$wsgi_script_source = undef,
) { ) {
include aodh::deps include aodh::deps
@@ -132,6 +142,9 @@ class aodh::wsgi::apache (
include apache::mod::ssl include apache::mod::ssl
} }
$wsgi_script_dir_real = pick($wsgi_script_dir, $::aodh::params::aodh_wsgi_script_path)
$wsgi_script_source_real = pick($wsgi_script_source, $::aodh::params::aodh_wsgi_script_source)
# NOTE(aschultz): needed because the packaging may introduce some apache # NOTE(aschultz): needed because the packaging may introduce some apache
# configuration files that apache may remove. See LP#1657847 # configuration files that apache may remove. See LP#1657847
Anchor['aodh::install::end'] -> Class['apache'] Anchor['aodh::install::end'] -> Class['apache']
@@ -157,9 +170,9 @@ class aodh::wsgi::apache (
wsgi_daemon_process => 'aodh', wsgi_daemon_process => 'aodh',
wsgi_process_display_name => $wsgi_process_display_name, wsgi_process_display_name => $wsgi_process_display_name,
wsgi_process_group => 'aodh', wsgi_process_group => 'aodh',
wsgi_script_dir => $::aodh::params::aodh_wsgi_script_path, wsgi_script_dir => $wsgi_script_dir_real,
wsgi_script_file => 'app', wsgi_script_file => 'app',
wsgi_script_source => $::aodh::params::aodh_wsgi_script_source, wsgi_script_source => $wsgi_script_source_real,
custom_wsgi_process_options => $custom_wsgi_process_options, custom_wsgi_process_options => $custom_wsgi_process_options,
access_log_file => $access_log_file, access_log_file => $access_log_file,
access_log_format => $access_log_format, access_log_format => $access_log_format,

View File

@@ -0,0 +1,6 @@
---
features:
- |
It is now possible to specify `aodh::wsgi::apache::wsgi_script_dir`
and `aodh::wsgi::apache::wsgi_script_source` to override operating
system defaults.

View File

@@ -42,7 +42,9 @@ describe 'aodh::wsgi::apache' do
}, },
:access_log_file => '/var/log/httpd/access_log', :access_log_file => '/var/log/httpd/access_log',
:access_log_format => 'some format', :access_log_format => 'some format',
:error_log_file => '/var/log/httpd/error_log' :error_log_file => '/var/log/httpd/error_log',
:wsgi_script_dir => '/var/lib/openstack/cgi-bin/aodh',
:wsgi_script_source => '/my/path/app.wsgi'
} }
end end
it { is_expected.to contain_class('aodh::params') } it { is_expected.to contain_class('aodh::params') }
@@ -62,9 +64,9 @@ describe 'aodh::wsgi::apache' do
:wsgi_daemon_process => 'aodh', :wsgi_daemon_process => 'aodh',
:wsgi_process_display_name => 'aodh', :wsgi_process_display_name => 'aodh',
:wsgi_process_group => 'aodh', :wsgi_process_group => 'aodh',
:wsgi_script_dir => platform_params[:wsgi_script_path], :wsgi_script_dir => '/var/lib/openstack/cgi-bin/aodh',
:wsgi_script_file => 'app', :wsgi_script_file => 'app',
:wsgi_script_source => platform_params[:wsgi_script_source], :wsgi_script_source => '/my/path/app.wsgi',
:custom_wsgi_process_options => { :custom_wsgi_process_options => {
'python_path' => '/my/python/path', 'python_path' => '/my/python/path',
}, },