Merge "Add log_dir param. by default and allow users to disable it"

This commit is contained in:
Jenkins 2014-02-21 01:20:38 +00:00 committed by Gerrit Code Review
commit e4fccb9e02
2 changed files with 23 additions and 1 deletions

View File

@ -12,7 +12,12 @@
# [log_facility]
# Syslog facility to receive log lines.
# (Optional) Defaults to LOG_USER.
#
# [*log_dir*]
# (optional) Directory where logs should be stored.
# If set to boolean false, it will not log to any directory.
# Defaults to '/var/log/cinder'
#
class cinder (
$sql_connection,
$sql_idle_timeout = '3600',
@ -42,6 +47,7 @@ class cinder (
$api_paste_config = '/etc/cinder/api-paste.ini',
$use_syslog = false,
$log_facility = 'LOG_USER',
$log_dir = '/var/log/cinder',
$verbose = false,
$debug = false
) {
@ -147,6 +153,16 @@ class cinder (
'DEFAULT/rpc_backend': value => $rpc_backend;
}
if $log_dir {
cinder_config {
'DEFAULT/log_dir': value => $log_dir;
}
} else {
cinder_config {
'DEFAULT/log_dir': ensure => absent;
}
}
if $use_syslog {
cinder_config {
'DEFAULT/use_syslog': value => true;

View File

@ -60,6 +60,7 @@ describe 'cinder' do
should contain_cinder_config('DEFAULT/api_paste_config').with(
:value => '/etc/cinder/api-paste.ini'
)
should contain_cinder_config('DEFAULT/log_dir').with(:value => '/var/log/cinder')
end
it { should contain_file('/etc/cinder/cinder.conf').with(
@ -207,4 +208,9 @@ describe 'cinder' do
it { should contain_cinder_config('DEFAULT/syslog_log_facility').with_value('LOG_LOCAL0') }
end
describe 'with log_dir disabled' do
let(:params) { req_params.merge!({:log_dir => false}) }
it { should contain_cinder_config('DEFAULT/log_dir').with_ensure('absent') }
end
end