Hi,
puppet --version 4.9.4
I need to configure a resource that will take a value from an array in hiera. I would like to implement a default value with a lookup in case this value is not configured:
resource in class called cron.pp
class yumcron::cron inherits yumcron {
cron { 'yum-cron':
command => 'yum -y update',
user => 'root',
hour => [1,3,4,6,7],
minute => '0',
month => "$cron_month",
}
}
and in init.pp for class yumcron
$cron_month = lookup({ name => 'yumcron::cron:cron_month', default_value => "[1,6]" }),
It won't work as the default seems not an array? the output is:
[root@perif1 ~]# puppet agent -tv --environment=temp
Info: Using configured environment 'temp'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Loading facts
Info: Caching catalog for perif1
Error: Failed to apply catalog: Parameter month failed on Cron[yum-cron]: [1,6] is not a valid month at /etc/puppetlabs/code/environments/temp/modules/yumcron/manifests/cron.pp:22
[root@perif1 ~]#
Can anyone please help me here?
Regards
Pablo
↧