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,7 +51,7 @@
|
|||||||
# Defaults to undef.
|
# Defaults to undef.
|
||||||
#
|
#
|
||||||
class heat::cron::purge_deleted (
|
class heat::cron::purge_deleted (
|
||||||
$ensure = present,
|
Enum['present', 'absent'] $ensure = present,
|
||||||
$minute = 1,
|
$minute = 1,
|
||||||
$hour = 0,
|
$hour = 0,
|
||||||
$monthday = '*',
|
$monthday = '*',
|
||||||
@ -60,15 +60,11 @@ class heat::cron::purge_deleted (
|
|||||||
$maxdelay = 0,
|
$maxdelay = 0,
|
||||||
$user = $::heat::params::user,
|
$user = $::heat::params::user,
|
||||||
$age = 1,
|
$age = 1,
|
||||||
$age_type = 'days',
|
Enum['days', 'hours', 'minutes', 'seconds'] $age_type = 'days',
|
||||||
$destination = '/var/log/heat/heat-purge_deleted.log',
|
$destination = '/var/log/heat/heat-purge_deleted.log',
|
||||||
$batch_size = undef,
|
$batch_size = undef,
|
||||||
) inherits heat::params {
|
) 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 {
|
if $maxdelay == 0 {
|
||||||
$sleep = ''
|
$sleep = ''
|
||||||
} else {
|
} else {
|
||||||
|
@ -109,16 +109,6 @@ describe 'heat::cron::purge_deleted' do
|
|||||||
)
|
)
|
||||||
end
|
end
|
||||||
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
|
end
|
||||||
|
|
||||||
on_supported_os({
|
on_supported_os({
|
||||||
|
Loading…
Reference in New Issue
Block a user