From f47eb9a9ff3d9d6e237439981be00ecbd50055d7 Mon Sep 17 00:00:00 2001 From: Juan Antonio Osorio Robles Date: Fri, 6 Oct 2017 14:23:38 +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: Iba77e0af493e37b427519baf09a22250e5c1ffa6 --- manifests/wsgi/apache.pp | 18 ++++++++++++++++++ spec/classes/cinder_wsgi_apache_spec.rb | 10 +++++++++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/manifests/wsgi/apache.pp b/manifests/wsgi/apache.pp index 7a61a9e7..2787f523 100644 --- a/manifests/wsgi/apache.pp +++ b/manifests/wsgi/apache.pp @@ -66,6 +66,18 @@ # apache::vhost ssl parameters. # Optional. Default to apache::vhost 'ssl_*' defaults. # +# [*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. +# # [*custom_wsgi_process_options*] # (optional) gives you the opportunity to add custom process options or to # overwrite the default options for the WSGI main process. @@ -101,6 +113,9 @@ class cinder::wsgi::apache ( $wsgi_process_display_name = undef, $threads = $::os_workers, $priority = '10', + $access_log_file = false, + $access_log_format = false, + $error_log_file = undef, $custom_wsgi_process_options = {}, ) { @@ -137,6 +152,9 @@ class cinder::wsgi::apache ( wsgi_script_file => 'cinder-api', wsgi_script_source => $::cinder::params::cinder_wsgi_script_source, custom_wsgi_process_options => $custom_wsgi_process_options, + access_log_file => $access_log_file, + access_log_format => $access_log_format, + error_log_file => $error_log_file, require => Anchor['cinder::install::end'], } } diff --git a/spec/classes/cinder_wsgi_apache_spec.rb b/spec/classes/cinder_wsgi_apache_spec.rb index fd2b1177..29212a36 100644 --- a/spec/classes/cinder_wsgi_apache_spec.rb +++ b/spec/classes/cinder_wsgi_apache_spec.rb @@ -22,7 +22,9 @@ describe 'cinder::wsgi::apache' do :wsgi_script_dir => platform_params[:wsgi_script_path], :wsgi_script_file => 'cinder-api', :wsgi_script_source => platform_params[:wsgi_script_source], - :custom_wsgi_process_options => {}, + :custom_wsgi_process_options => {}, + :access_log_file => false, + :access_log_format => false, )} end @@ -38,6 +40,9 @@ describe 'cinder::wsgi::apache' do :custom_wsgi_process_options => { 'python_path' => '/my/python/admin/path', }, + :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_class('cinder::params') } @@ -63,6 +68,9 @@ describe 'cinder::wsgi::apache' do :custom_wsgi_process_options => { 'python_path' => '/my/python/admin/path', }, + :access_log_file => '/var/log/httpd/access_log', + :access_log_format => 'some format', + :error_log_file => '/var/log/httpd/error_log' )} end end