expirer: remove the crontab if enable_cron is False
Allow to let Puppet removing the crontab when ceilometer::expirer::enable_cron is set to False. It's useful when you want to upgrade from Ocata to Pike and you want the crontab to be removed, since ceilometer-expirer is deprecated in Pike. Change-Id: I1eb243be7bbc38ab5977bcf6a649e98eb6ff77f7
This commit is contained in:
parent
3d45585f8f
commit
1ef657da0e
@ -23,6 +23,8 @@
|
||||
#
|
||||
# [*enable_cron*]
|
||||
# (optional) Whether to configure a crontab entry to run the expiry.
|
||||
# When set to False, Puppet will try to remove the crontab.
|
||||
# It's useful when we upgrade from Ocata to Pike and want to remove it.
|
||||
# Defaults to true.
|
||||
#
|
||||
# [*minute*]
|
||||
@ -54,16 +56,21 @@ class ceilometer::expirer (
|
||||
Anchor['ceilometer::install::end'] ~> Class['ceilometer::expirer']
|
||||
|
||||
if $enable_cron {
|
||||
cron { 'ceilometer-expirer':
|
||||
command => $ceilometer::params::expirer_command,
|
||||
environment => 'PATH=/bin:/usr/bin:/usr/sbin SHELL=/bin/sh',
|
||||
user => 'ceilometer',
|
||||
minute => $minute,
|
||||
hour => $hour,
|
||||
monthday => $monthday,
|
||||
month => $month,
|
||||
weekday => $weekday
|
||||
}
|
||||
$ensure = 'present'
|
||||
} else {
|
||||
$ensure = 'absent'
|
||||
}
|
||||
|
||||
cron { 'ceilometer-expirer':
|
||||
ensure => $ensure,
|
||||
command => $ceilometer::params::expirer_command,
|
||||
environment => 'PATH=/bin:/usr/bin:/usr/sbin SHELL=/bin/sh',
|
||||
user => 'ceilometer',
|
||||
minute => $minute,
|
||||
hour => $hour,
|
||||
monthday => $monthday,
|
||||
month => $month,
|
||||
weekday => $weekday
|
||||
}
|
||||
|
||||
}
|
||||
|
5
releasenotes/notes/ceilo-expirer-3b86bfc71c21aa08.yaml
Normal file
5
releasenotes/notes/ceilo-expirer-3b86bfc71c21aa08.yaml
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
upgrade:
|
||||
- When ceilometer::expirer::enable_cron is set to False, Puppet will
|
||||
try to remove the crontab. It's useful when you upgrade from Ocata
|
||||
to Pike and you want the crontab to be removed (the service is deprecated).
|
@ -44,6 +44,7 @@ describe 'ceilometer::expirer' do
|
||||
|
||||
it 'configures a cron' do
|
||||
is_expected.to contain_cron('ceilometer-expirer').with(
|
||||
:ensure => 'present',
|
||||
:command => 'ceilometer-expirer',
|
||||
:environment => 'PATH=/bin:/usr/bin:/usr/sbin SHELL=/bin/sh',
|
||||
:user => 'ceilometer',
|
||||
@ -60,7 +61,19 @@ describe 'ceilometer::expirer' do
|
||||
params.merge!({
|
||||
:enable_cron => false })
|
||||
end
|
||||
it { is_expected.to_not contain_cron('ceilometer-expirer') }
|
||||
it {
|
||||
is_expected.to contain_cron('ceilometer-expirer').with(
|
||||
:ensure => 'absent',
|
||||
:command => 'ceilometer-expirer',
|
||||
:environment => 'PATH=/bin:/usr/bin:/usr/sbin SHELL=/bin/sh',
|
||||
:user => 'ceilometer',
|
||||
:minute => 1,
|
||||
:hour => 0,
|
||||
:monthday => '*',
|
||||
:month => '*',
|
||||
:weekday => '*'
|
||||
)
|
||||
}
|
||||
end
|
||||
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user