make crontab for expirer optional
This adds an 'enable_cron' switch to ceilometer::expirer, defaults to true, so that if we want to configure the TTL but don't want to run the expiry job via cron we don't have to. Closes-Bug: 1468937 Change-Id: I7fd89e58f70ae41628e769ed24f1ef5c15af51f9
This commit is contained in:
parent
4d18c07eed
commit
f612d92bfb
@ -26,6 +26,10 @@
|
||||
# Should be a valid integer
|
||||
# Defaults to '-1' to disable TTL and keep forever the datas.
|
||||
#
|
||||
# [*enable_cron*]
|
||||
# (optional) Whether to configure a crontab entry to run the expiry.
|
||||
# Defaults to true.
|
||||
#
|
||||
# [*minute*]
|
||||
# (optional) Defaults to '1'.
|
||||
#
|
||||
@ -44,6 +48,7 @@
|
||||
|
||||
class ceilometer::expirer (
|
||||
$time_to_live = '-1',
|
||||
$enable_cron = True,
|
||||
$minute = 1,
|
||||
$hour = 0,
|
||||
$monthday = '*',
|
||||
@ -59,6 +64,7 @@ class ceilometer::expirer (
|
||||
'database/time_to_live': value => $time_to_live;
|
||||
}
|
||||
|
||||
if $enable_cron {
|
||||
cron { 'ceilometer-expirer':
|
||||
command => $ceilometer::params::expirer_command,
|
||||
environment => 'PATH=/bin:/usr/bin:/usr/sbin SHELL=/bin/sh',
|
||||
@ -69,6 +75,6 @@ class ceilometer::expirer (
|
||||
month => $month,
|
||||
weekday => $weekday
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -54,6 +54,14 @@ describe 'ceilometer::expirer' do
|
||||
)
|
||||
end
|
||||
|
||||
context 'with cron not enabled' do
|
||||
before do
|
||||
params.merge!({
|
||||
:enable_cron => false })
|
||||
end
|
||||
it { is_expected.to_not contain_cron('ceilometer-expirer') }
|
||||
end
|
||||
|
||||
it 'configures database section in ceilometer.conf' do
|
||||
is_expected.to contain_ceilometer_config('database/time_to_live').with_value( params[:time_to_live] )
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user