Allow setting log files for apache vhost

This allows the setting of the error and access file logs, as well as
the access log format. This was done in a similar fashion as one can
configure these ones in the keystone wsgi manifest.

Change-Id: I5e7d3588b7b3b106813d6d37b55aa812273d04d6
This commit is contained in:
Juan Antonio Osorio Robles
2017-10-03 12:51:27 +03:00
parent 8b0adfdab9
commit 546eb8fb41
2 changed files with 31 additions and 3 deletions

View File

@@ -154,6 +154,18 @@
# underlying vhost resource. # underlying vhost resource.
# Defaults to undef. # Defaults to undef.
# #
# [*access_log_file*]
# The log file name for the virtualhost.
# Optional. Defaults to false.
#
# [*access_log_format*]
# The log format for the virtualhost.
# Optional. Defaults to false.
#
# [*error_log_file*]
# The error log file name for the virtualhost.
# Optional. Defaults to undef.
#
define openstacklib::wsgi::apache ( define openstacklib::wsgi::apache (
$service_name = $name, $service_name = $name,
$bind_host = undef, $bind_host = undef,
@@ -185,6 +197,9 @@ define openstacklib::wsgi::apache (
$custom_wsgi_process_options = {}, $custom_wsgi_process_options = {},
$vhost_custom_fragment = undef, $vhost_custom_fragment = undef,
$allow_encoded_slashes = undef, $allow_encoded_slashes = undef,
$access_log_file = false,
$access_log_format = false,
$error_log_file = undef,
) { ) {
include ::apache include ::apache
@@ -253,6 +268,9 @@ define openstacklib::wsgi::apache (
wsgi_chunked_request => $wsgi_chunked_request, wsgi_chunked_request => $wsgi_chunked_request,
custom_fragment => $vhost_custom_fragment, custom_fragment => $vhost_custom_fragment,
allow_encoded_slashes => $allow_encoded_slashes, allow_encoded_slashes => $allow_encoded_slashes,
access_log_file => $access_log_file,
access_log_format => $access_log_format,
error_log_file => $error_log_file,
} }
Package<| title == 'httpd' |> Package<| title == 'httpd' |>

View File

@@ -37,7 +37,9 @@ describe 'openstacklib::wsgi::apache' do
:user => 'keystone', :user => 'keystone',
:wsgi_script_dir => '/var/www/cgi-bin/keystone', :wsgi_script_dir => '/var/www/cgi-bin/keystone',
:wsgi_script_file => 'main', :wsgi_script_file => 'main',
:wsgi_script_source => '/usr/share/keystone/keystone.wsgi' :wsgi_script_source => '/usr/share/keystone/keystone.wsgi',
:access_log_file => false,
:access_log_format => false,
} }
end end
@@ -83,7 +85,9 @@ describe 'openstacklib::wsgi::apache' do
'display-name' => 'keystone_wsgi', 'display-name' => 'keystone_wsgi',
}, },
'wsgi_application_group' => '%{GLOBAL}', 'wsgi_application_group' => '%{GLOBAL}',
'setenvif' => ['X-Forwarded-Proto https HTTPS=1'] 'setenvif' => ['X-Forwarded-Proto https HTTPS=1'],
'access_log_file' => false,
'access_log_format' => false,
)} )}
it { is_expected.to contain_concat("#{platform_params[:httpd_ports_file]}") } it { is_expected.to contain_concat("#{platform_params[:httpd_ports_file]}") }
end end
@@ -105,6 +109,9 @@ describe 'openstacklib::wsgi::apache' do
:workers => 37, :workers => 37,
:vhost_custom_fragment => 'LimitRequestFieldSize 81900', :vhost_custom_fragment => 'LimitRequestFieldSize 81900',
:allow_encoded_slashes => 'on', :allow_encoded_slashes => 'on',
:access_log_file => '/var/log/httpd/access_log',
:access_log_format => 'some format',
:error_log_file => '/var/log/httpd/error_log'
} }
end end
it { is_expected.to contain_apache__vhost('keystone_wsgi').with( it { is_expected.to contain_apache__vhost('keystone_wsgi').with(
@@ -127,7 +134,10 @@ describe 'openstacklib::wsgi::apache' do
'wsgi_pass_authorization' => 'On', 'wsgi_pass_authorization' => 'On',
'wsgi_chunked_request' => 'On', 'wsgi_chunked_request' => 'On',
'custom_fragment' => 'LimitRequestFieldSize 81900', 'custom_fragment' => 'LimitRequestFieldSize 81900',
'allow_encoded_slashes' => 'on', 'allow_encoded_slashes' => 'on',
'access_log_file' => '/var/log/httpd/access_log',
'access_log_format' => 'some format',
'error_log_file' => '/var/log/httpd/error_log'
)} )}
end end