Validate status of cron resource
This makes sure that the supported value is used for the parameters which determine the ensure property of a cron resource type. This also re-implements the validation of age_type parameter using the native data type. Change-Id: Ie3d9c4d3dac3484051be3b9418e833454c0fbd2a
This commit is contained in:
parent
7d927b9a02
commit
c62209b8e7
@ -51,24 +51,20 @@
|
||||
# Defaults to undef.
|
||||
#
|
||||
class heat::cron::purge_deleted (
|
||||
$ensure = present,
|
||||
$minute = 1,
|
||||
$hour = 0,
|
||||
$monthday = '*',
|
||||
$month = '*',
|
||||
$weekday = '*',
|
||||
$maxdelay = 0,
|
||||
$user = $::heat::params::user,
|
||||
$age = 1,
|
||||
$age_type = 'days',
|
||||
$destination = '/var/log/heat/heat-purge_deleted.log',
|
||||
$batch_size = undef,
|
||||
Enum['present', 'absent'] $ensure = present,
|
||||
$minute = 1,
|
||||
$hour = 0,
|
||||
$monthday = '*',
|
||||
$month = '*',
|
||||
$weekday = '*',
|
||||
$maxdelay = 0,
|
||||
$user = $::heat::params::user,
|
||||
$age = 1,
|
||||
Enum['days', 'hours', 'minutes', 'seconds'] $age_type = 'days',
|
||||
$destination = '/var/log/heat/heat-purge_deleted.log',
|
||||
$batch_size = undef,
|
||||
) inherits heat::params {
|
||||
|
||||
if ! member(['days', 'hours', 'minutes', 'seconds'], $age_type) {
|
||||
fail('age_type possible values are only days, hours, minutes, or seconds.')
|
||||
}
|
||||
|
||||
if $maxdelay == 0 {
|
||||
$sleep = ''
|
||||
} else {
|
||||
|
@ -109,16 +109,6 @@ describe 'heat::cron::purge_deleted' do
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'when setting a wrong age_type' do
|
||||
before :each do
|
||||
params.merge!(
|
||||
:age_type => 'foobar'
|
||||
)
|
||||
end
|
||||
|
||||
it_raises 'a Puppet::Error', /age_type possible values are only days, hours, minutes, or seconds./
|
||||
end
|
||||
end
|
||||
|
||||
on_supported_os({
|
||||
|
Loading…
x
Reference in New Issue
Block a user