From 546eb8fb4142b797cf6c5618d4cc512fa8773d0a Mon Sep 17 00:00:00 2001 From: Juan Antonio Osorio Robles Date: Tue, 3 Oct 2017 12:51:27 +0300 Subject: [PATCH] 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 --- manifests/wsgi/apache.pp | 18 ++++++++++++++++++ spec/defines/openstacklib_wsgi_apache_spec.rb | 16 +++++++++++++--- 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/manifests/wsgi/apache.pp b/manifests/wsgi/apache.pp index 953d412c..d931d727 100644 --- a/manifests/wsgi/apache.pp +++ b/manifests/wsgi/apache.pp @@ -154,6 +154,18 @@ # underlying vhost resource. # 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 ( $service_name = $name, $bind_host = undef, @@ -185,6 +197,9 @@ define openstacklib::wsgi::apache ( $custom_wsgi_process_options = {}, $vhost_custom_fragment = undef, $allow_encoded_slashes = undef, + $access_log_file = false, + $access_log_format = false, + $error_log_file = undef, ) { include ::apache @@ -253,6 +268,9 @@ define openstacklib::wsgi::apache ( wsgi_chunked_request => $wsgi_chunked_request, custom_fragment => $vhost_custom_fragment, 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' |> diff --git a/spec/defines/openstacklib_wsgi_apache_spec.rb b/spec/defines/openstacklib_wsgi_apache_spec.rb index 8371a116..7eee298d 100644 --- a/spec/defines/openstacklib_wsgi_apache_spec.rb +++ b/spec/defines/openstacklib_wsgi_apache_spec.rb @@ -37,7 +37,9 @@ describe 'openstacklib::wsgi::apache' do :user => 'keystone', :wsgi_script_dir => '/var/www/cgi-bin/keystone', :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 @@ -83,7 +85,9 @@ describe 'openstacklib::wsgi::apache' do 'display-name' => 'keystone_wsgi', }, '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]}") } end @@ -105,6 +109,9 @@ describe 'openstacklib::wsgi::apache' do :workers => 37, :vhost_custom_fragment => 'LimitRequestFieldSize 81900', :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 it { is_expected.to contain_apache__vhost('keystone_wsgi').with( @@ -127,7 +134,10 @@ describe 'openstacklib::wsgi::apache' do 'wsgi_pass_authorization' => 'On', 'wsgi_chunked_request' => 'On', '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