So the error message
Syntax error at '}'; expected '}'
is not helping me find my problem.
I'm trying to do something tricky, where I have this (shortened and anonymized) and the `$cron` variable set to `mon:12:0,wed:9:30`
class symantec
(
$version,
$style = "unmanaged",
$cron = '',
)
{
define createCronJob {
$lines = split ($name,',')
$lines[0] = split ($lines[0],':')
$lines[1] = split ($lines[1],':')
file { 'symantec.cron' :
ensure => file,
path => "/etc/cron.d/symantec.liveupdate.cron",
content =>
"#
# this file is managed by puppet.
#
${lines[0][2]} ${lines[0][1]} * * ${lines[0][0]} root /usr/local/bin/system_patch.pl
${lines[1][2]} ${lines[1][1]} * * ${lines[1][0]} root /usr/local/bin/system_patch.pl
"
}
}
if $style == "unmanaged"
{
createCronJob { [ $cron ] } /* <= <= <= line with the error */
}
}
It's supposed to create a file that looks like this:
#
# this file is managed by puppet.
#
0 12 * * mon root /usr/local/bin/system_patch.pl
30 9 * * wed root /usr/local/bin/system_patch.pl
I can take out the offending line and the catalog compiles and runs fine. I tested it separately with `puppet apply` and it was working and created the file. But I must be doing something different and I don't know what.
So I guess I have two questions.
Why does the error message seem to make no sense?
How can I properly call my defined function to create the file?
↧