Skip to content

Commit

Permalink
Fix logging setup on Debian
Browse files Browse the repository at this point in the history
  • Loading branch information
ekohl committed Oct 1, 2018
1 parent 7c7032f commit 16bd4e7
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 13 deletions.
3 changes: 2 additions & 1 deletion manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
$global_group = $nginx::global_group
$global_mode = $nginx::global_mode
$log_dir = $nginx::log_dir
$log_user = $nginx::log_user
$log_group = $nginx::log_group
$log_mode = $nginx::log_mode
$http_access_log = $nginx::http_access_log
Expand Down Expand Up @@ -178,7 +179,7 @@
file { $log_dir:
ensure => directory,
mode => $log_mode,
owner => $daemon_user,
owner => $log_user,
group => $log_group,
}

Expand Down
7 changes: 4 additions & 3 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,10 @@
$global_owner = $nginx::params::global_owner,
$global_group = $nginx::params::global_group,
$global_mode = $nginx::params::global_mode,
$log_dir = $nginx::params::log_dir,
$log_group = $nginx::params::log_group,
$log_mode = '0750',
Stdlib::Absolutepath $log_dir = $nginx::params::log_dir,
String $log_user = $nginx::params::log_user,
String $log_group = $nginx::params::log_group,
Stdlib::Filemode $log_mode = $nginx::params::log_mode,
Variant[String, Array[String]] $http_access_log = "${log_dir}/${nginx::params::http_access_log_file}",
$http_format_log = undef,
Variant[String, Array[String]] $nginx_error_log = "${log_dir}/${nginx::params::nginx_error_log_file}",
Expand Down
22 changes: 15 additions & 7 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@
### Operating System Configuration
## This is my hacky... no hiera system. Oh well. :)
$_module_defaults = {
'conf_dir' => '/etc/nginx',
'daemon_user' => 'nginx',
'pid' => '/var/run/nginx.pid',
'root_group' => 'root',
'log_dir' => '/var/log/nginx',
'log_group' => 'root',
'run_dir' => '/var/nginx',
'conf_dir' => '/etc/nginx',
'daemon_user' => 'nginx',
'pid' => '/var/run/nginx.pid',
'root_group' => 'root',
'log_dir' => '/var/log/nginx',
'log_user' => 'nginx',
'log_group' => 'root',
'log_mode' => '0750',
'run_dir' => '/var/nginx',
'package_name' => 'nginx',
'manage_repo' => false,
'mime_types' => {
Expand Down Expand Up @@ -109,12 +111,16 @@
$_module_os_overrides = {
'manage_repo' => true,
'daemon_user' => 'www-data',
'log_user' => 'root',
'log_group' => 'adm',
'log_mode' => '0755',
}
} else {
$_module_os_overrides = {
'daemon_user' => 'www-data',
'log_user' => 'root',
'log_group' => 'adm',
'log_mode' => '0755',
}
}
}
Expand Down Expand Up @@ -178,7 +184,9 @@
### Referenced Variables
$conf_dir = $_module_parameters['conf_dir']
$log_dir = $_module_parameters['log_dir']
$log_user = $_module_parameters['log_user']
$log_group = $_module_parameters['log_group']
$log_mode = $_module_parameters['log_mode']
$run_dir = $_module_parameters['run_dir']
$temp_dir = '/tmp'
$pid = $_module_parameters['pid']
Expand Down
4 changes: 2 additions & 2 deletions spec/classes/nginx_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -360,9 +360,9 @@
it do
is_expected.to contain_file('/var/log/nginx').with(
ensure: 'directory',
owner: 'www-data',
owner: 'root',
group: 'adm',
mode: '0750'
mode: '0755'
)
end
end
Expand Down

0 comments on commit 16bd4e7

Please sign in to comment.