Skip to content

Commit

Permalink
Merge pull request voxpupuli#904 from wyardley/issue_895_log_dir
Browse files Browse the repository at this point in the history
fix for log_dir not being honored (voxpupuli#895)
  • Loading branch information
bastelfreak committed Oct 8, 2016
2 parents ed4639a + 769e09c commit 674e6e4
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
4 changes: 2 additions & 2 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
$global_group = $::nginx::params::global_group,
$global_mode = $::nginx::params::global_mode,
$log_dir = $::nginx::params::log_dir,
$http_access_log = $::nginx::params::http_access_log,
$http_access_log = "${log_dir}/${::nginx::params::http_access_log_file}",
$http_format_log = undef,
$nginx_error_log = $::nginx::params::nginx_error_log,
$nginx_error_log = "${log_dir}/${::nginx::params::nginx_error_log_file}",
$nginx_error_log_severity = 'error',
$pid = $::nginx::params::pid,
$proxy_temp_path = $::nginx::params::proxy_temp_path,
Expand Down
4 changes: 2 additions & 2 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,9 @@
$global_owner = 'root'
$global_group = $_module_parameters['root_group']
$global_mode = '0644'
$http_access_log = "${log_dir}/access.log"
$http_access_log_file = 'access.log'
$manage_repo = $_module_parameters['manage_repo']
$nginx_error_log = "${log_dir}/error.log"
$nginx_error_log_file = 'error.log'
$root_group = $_module_parameters['root_group']
$package_name = $_module_parameters['package_name']
$proxy_temp_path = "${run_dir}/proxy_temp"
Expand Down
16 changes: 16 additions & 0 deletions spec/classes/config_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -691,5 +691,21 @@

it { expect { is_expected.to contain_class('nginx::config') }.to raise_error(Puppet::Error, %r{\$nginx_error_log_severity must be debug, info, notice, warn, error, crit, alert or emerg}) }
end

context 'when log_dir is non-default' do
let(:params) { { log_dir: '/foo/bar' } }

it { is_expected.to contain_file('/foo/bar').with(ensure: 'directory') }
it do
is_expected.to contain_file('/etc/nginx/nginx.conf').with_content(
%r{access_log /foo/bar/access.log;}
)
end
it do
is_expected.to contain_file('/etc/nginx/nginx.conf').with_content(
%r{error_log /foo/bar/error.log error;}
)
end
end
end
end

0 comments on commit 674e6e4

Please sign in to comment.