Rename the parameter to define the state of panko-expirer cron job
This patch replaces the panko::expirer::enable_cron parameter by panko::expirer::ensure parameter, so that the parameter name shows how the parameter actually behaves more clearly. Change-Id: I00518ee991df9ab8fbfcb3309413939c500849f7
This commit is contained in:
parent
310d39a615
commit
4184e32676
|
@ -5,10 +5,9 @@
|
|||
#
|
||||
# === Parameters
|
||||
#
|
||||
# [*enable_cron*]
|
||||
# (optional) Whether to configure a crontab entry to run the expiry.
|
||||
# When set to False, Puppet will try to remove the crontab.
|
||||
# Defaults to true.
|
||||
# [*ensure*]
|
||||
# (optional) The state of cron job.
|
||||
# Defaults to present.
|
||||
#
|
||||
# [*minute*]
|
||||
# (optional) Defaults to '1'.
|
||||
|
@ -31,23 +30,39 @@
|
|||
# all cron jobs at the same time on all hosts this job is configured.
|
||||
# Defaults to 0.
|
||||
#
|
||||
# DEPRECATED PARAMETERS
|
||||
#
|
||||
# [*enable_cron*]
|
||||
# (optional) Whether to configure a crontab entry to run the expiry.
|
||||
# When set to False, Puppet will try to remove the crontab.
|
||||
# Defaults to undef,
|
||||
#
|
||||
class panko::expirer (
|
||||
$enable_cron = true,
|
||||
$ensure = 'present',
|
||||
$minute = 1,
|
||||
$hour = 0,
|
||||
$monthday = '*',
|
||||
$month = '*',
|
||||
$weekday = '*',
|
||||
$maxdelay = 0,
|
||||
# DEPRECATED PARAMETERS
|
||||
$enable_cron = undef,
|
||||
) {
|
||||
|
||||
include panko::params
|
||||
include panko::deps
|
||||
|
||||
if $enable_cron {
|
||||
$ensure = 'present'
|
||||
if $enable_cron != undef {
|
||||
warning('The panko::expirer::enable_cron is deprecated and will be removed \
|
||||
in a future release. Use panko::expirer::ensure instead')
|
||||
|
||||
if $enable_cron {
|
||||
$ensure_real = 'present'
|
||||
} else {
|
||||
$ensure_real = 'absent'
|
||||
}
|
||||
} else {
|
||||
$ensure = 'absent'
|
||||
$ensure_real = $ensure
|
||||
}
|
||||
|
||||
if $maxdelay == 0 {
|
||||
|
@ -57,7 +72,7 @@ class panko::expirer (
|
|||
}
|
||||
|
||||
cron { 'panko-expirer':
|
||||
ensure => $ensure,
|
||||
ensure => $ensure_real,
|
||||
command => "${sleep}${panko::params::expirer_command}",
|
||||
environment => 'PATH=/bin:/usr/bin:/usr/sbin SHELL=/bin/sh',
|
||||
user => 'panko',
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
deprecations:
|
||||
- |
|
||||
The ``panko::expirer::enable_cron`` parameter has been deprecated and will
|
||||
be removed in a future release. Use ``panko::expirer::ensure`` instead.
|
|
@ -26,14 +26,17 @@ describe 'panko::expirer' do
|
|||
|
||||
context 'with overridden parameters' do
|
||||
before do
|
||||
params.merge!( :maxdelay => 300 )
|
||||
params.merge!(
|
||||
:ensure => 'absent',
|
||||
:maxdelay => 300
|
||||
)
|
||||
end
|
||||
|
||||
it { is_expected.to contain_class('panko::deps') }
|
||||
it { is_expected.to contain_class('panko::params') }
|
||||
|
||||
it { is_expected.to contain_cron('panko-expirer').with(
|
||||
:ensure => 'present',
|
||||
:ensure => 'absent',
|
||||
:command => 'sleep `expr ${RANDOM} \\% 300`; panko-expirer',
|
||||
:environment => 'PATH=/bin:/usr/bin:/usr/sbin SHELL=/bin/sh',
|
||||
:user => 'panko',
|
||||
|
@ -46,7 +49,7 @@ describe 'panko::expirer' do
|
|||
)}
|
||||
end
|
||||
|
||||
context 'with cron not enabled' do
|
||||
context 'with deprecated parameter' do
|
||||
before do
|
||||
params.merge!( :enable_cron => false )
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue