Add access_log_format for WSGI

Adds the access_log_format parameter that can be used to set
the log format that is used in the vhosts that puppetlabs-apache
manages.

Adds the same parameter to the init class to make sure that you
can set it when managing apache from there and not including the
wsgi::apache class manually.

The default value of the parameter is the same as enforced in other
modules that has the access_log_format, which is false. That is the
default that the puppetlabs-apache module has.

Change-Id: Ie8ac84c6231ad55c5974a95b50238f0d006b6336
This commit is contained in:
Tobias Urdin 2018-12-10 11:30:27 +01:00
parent 7a581215d9
commit a0468fd8cb
5 changed files with 55 additions and 30 deletions

View File

@ -306,6 +306,10 @@
# (optional) The path to the location of static assets.
# Defaults to "${::horizon::params::static_path}/openstack-dashboard"
#
# [*access_log_format*]
# (optional) The log format for the access log.
# Defaults to false
#
# [*session_timeout*]
# (optional) The session timeout for horizon in seconds. After this many seconds of inactivity
# the user is logged out.
@ -511,6 +515,7 @@ class horizon(
$overview_days_range = undef,
$root_url = $::horizon::params::root_url,
$root_path = "${::horizon::params::static_path}/openstack-dashboard",
$access_log_format = false,
$session_timeout = 1800,
$timezone = 'UTC',
$secure_cookies = false,
@ -653,22 +658,23 @@ class horizon(
if $configure_apache {
class { '::horizon::wsgi::apache':
bind_address => $bind_address,
servername => $servername,
server_aliases => $server_aliases,
listen_ssl => $listen_ssl,
http_port => $http_port,
https_port => $https_port,
ssl_redirect => $ssl_redirect,
horizon_cert => $horizon_cert,
horizon_key => $horizon_key,
horizon_ca => $horizon_ca,
wsgi_processes => $wsgi_processes,
wsgi_threads => $wsgi_threads,
extra_params => $vhost_extra_params,
redirect_type => $redirect_type,
root_url => $root_url,
root_path => $root_path,
bind_address => $bind_address,
servername => $servername,
server_aliases => $server_aliases,
listen_ssl => $listen_ssl,
http_port => $http_port,
https_port => $https_port,
ssl_redirect => $ssl_redirect,
horizon_cert => $horizon_cert,
horizon_key => $horizon_key,
horizon_ca => $horizon_ca,
wsgi_processes => $wsgi_processes,
wsgi_threads => $wsgi_threads,
extra_params => $vhost_extra_params,
redirect_type => $redirect_type,
root_url => $root_url,
root_path => $root_path,
access_log_format => $access_log_format,
}
}

View File

@ -87,6 +87,10 @@
# (optional) The path to the location of static assets.
# Defaults to "${::horizon::params::static_path}/openstack-dashboard"
#
# [*access_log_format*]
# (optional) The log format to use to the access log.
# Defaults to false
#
class horizon::wsgi::apache (
$bind_address = undef,
$servername = $::fqdn,
@ -108,6 +112,7 @@ class horizon::wsgi::apache (
$redirect_type = 'permanent',
$root_url = $::horizon::params::root_url,
$root_path = "${::horizon::params::static_path}/openstack-dashboard",
$access_log_format = false,
) inherits horizon::params {
include ::horizon::deps
@ -220,6 +225,7 @@ class horizon::wsgi::apache (
serveraliases => any2array($server_aliases),
docroot => '/var/www/',
access_log_file => 'horizon_access.log',
access_log_format => $access_log_format,
error_log_file => 'horizon_error.log',
priority => $priority,
aliases => [{

View File

@ -0,0 +1,5 @@
---
features:
- |
Added horizon::access_log_format and horizon::wsgi::apache::access_log_format
that can be used to set the log format for the access log.

View File

@ -43,12 +43,13 @@ describe 'horizon' do
it 'configures apache' do
is_expected.to contain_class('horizon::wsgi::apache').with({
:servername => 'some.host.tld',
:listen_ssl => false,
:wsgi_processes => facts[:os_workers],
:wsgi_threads => '1',
:extra_params => {},
:redirect_type => 'permanent',
:servername => 'some.host.tld',
:listen_ssl => false,
:wsgi_processes => facts[:os_workers],
:wsgi_threads => '1',
:extra_params => {},
:redirect_type => 'permanent',
:access_log_format => false,
})
end
@ -291,13 +292,15 @@ describe 'horizon' do
context 'with custom wsgi options' do
before do
params.merge!( :wsgi_processes => '30',
:wsgi_threads => '5' )
params.merge!( :wsgi_processes => '30',
:wsgi_threads => '5',
:access_log_format => 'common' )
end
it { should contain_class('horizon::wsgi::apache').with(
:wsgi_processes => '30',
:wsgi_threads => '5',
:wsgi_processes => '30',
:wsgi_threads => '5',
:access_log_format => 'common',
)}
end

View File

@ -30,6 +30,7 @@ describe 'horizon::wsgi::apache' do
it { should contain_apache__vhost('horizon_vhost').with(
:servername => 'some.host.tld',
:access_log_file => 'horizon_access.log',
:access_log_format => false,
:error_log_file => 'horizon_error.log',
:priority => '15',
:serveraliases => ['some.host.tld'],
@ -56,10 +57,11 @@ describe 'horizon::wsgi::apache' do
context 'with overridden parameters' do
before do
params.merge!({
:priority => '10',
:redirect_type => 'temp',
:wsgi_processes => '13',
:wsgi_threads => '3'
:priority => '10',
:redirect_type => 'temp',
:wsgi_processes => '13',
:wsgi_threads => '3',
:access_log_format => 'common',
})
end
@ -74,6 +76,7 @@ describe 'horizon::wsgi::apache' do
it { should contain_apache__vhost('horizon_vhost').with(
:servername => 'some.host.tld',
:access_log_file => 'horizon_access.log',
:access_log_format => 'common',
:error_log_file => 'horizon_error.log',
:priority => params[:priority],
:serveraliases => ['some.host.tld'],
@ -135,6 +138,7 @@ describe 'horizon::wsgi::apache' do
it { should contain_apache__vhost('horizon_ssl_vhost').with(
:servername => 'some.host.tld',
:access_log_file => 'horizon_ssl_access.log',
:access_log_format => false,
:error_log_file => 'horizon_ssl_error.log',
:priority => '15',
:serveraliases => ['some.host.tld'],
@ -158,6 +162,7 @@ describe 'horizon::wsgi::apache' do
it { should contain_apache__vhost('horizon_vhost').with(
:servername => 'some.host.tld',
:access_log_file => 'horizon_access.log',
:access_log_format => false,
:error_log_file => 'horizon_error.log',
:priority => '15',
:serveraliases => ['some.host.tld'],