Skip to content

Commit

Permalink
Manage logging directory and file
Browse files Browse the repository at this point in the history
  • Loading branch information
baurmatt committed Sep 20, 2017
1 parent a465734 commit 628c1e0
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
14 changes: 14 additions & 0 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

$logging = $::icingaweb2::logging
$logging_file = $::icingaweb2::logging_file
$logging_dir = dirname($::icingaweb2::logging_file)
$logging_level = $::icingaweb2::logging_level
$preferences_type = 'ini'
$show_stacktraces = $::icingaweb2::show_stacktraces
Expand Down Expand Up @@ -47,6 +48,19 @@
path => $::path,
}

file { $logging_dir:
ensure => directory,
owner => $conf_user,
group => 'adm',
mode => '0750',
}
file { $logging_file:
ensure => file,
owner => $conf_user,
group => 'adm',
mode => '0640',
}

icingaweb2::inisection {'logging':
target => "${conf_dir}/config.ini",
settings => {
Expand Down
8 changes: 8 additions & 0 deletions spec/classes/config_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@
it { is_expected.to contain_icingaweb2__inisection('logging') }
it { is_expected.to contain_icingaweb2__inisection('global') }
it { is_expected.to contain_icingaweb2__inisection('themes') }
it { is_expected.to contain_file('/var/log/icingaweb2')
.with_ensure('directory')
.with_mode('0750')
}
it { is_expected.to contain_file('/var/log/icingaweb2/icingaweb2.log')
.with_ensure('file')
.with_mode('0640')
}
end

context 'with import_schema => true and db_type => mysql' do
Expand Down

0 comments on commit 628c1e0

Please sign in to comment.