[Puppet Users] Re: if statement in class not working...

trey85stang
Wed, 09 Feb 2011 18:23:38 -0000

I have figured it out,  the cron name had a dot n it.  I needed to
encase that in quotes before it would work.  so it wasn''t a syntax
error like the log message was leading me to believe.

On Feb 9, 12:10 pm, trey85stang <trey85st...@gmail.com>
wrote:
> I have a simple class like so for cronjobs:
>
> class cron_jobs {
>   cron { cron1:
>     command => "/path/to/cron1",
>     user    => root,
>     hour    => 0,
>     minute  => 5,
>     ensure  => present,
>   }
>   cron { cron2:
>     command => "/path/to/cron2",
>     user    => root,
>     hour    => 0,
>     minute  => 0,
>     ensure  => present,
>   }
>   if $myvar == ''foo'' {
>     cron { cron3.$myvar:
>       command => "/path/to/cron3",
>       user    => root,
>     }
>   } else {
>     cron { cron3.$myvar:
>       commad => "/path/to/cron3",
>       user   => root,
>     }
>   }
>
> }
>
> but I am obviously doing something wrong because the clients always
> give a syntax error:
>
> Could not retrieve catalog from remote server: Error 400 on SERVER:
> Syntax error at ''.''; expected ''}'' at
/etc/puppet/modules/cron_jobs/
> manifests/init.pp:17 on node noe.domain.com
>
> Can anyone tell me what I am doing wrong?  I''ve also tried with a
case
> statement instead of if but I get the same syntax error at the first
> cron line.   So Im guessing something is wrong with the cron command
> in the bracked if statement ?

--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to
puppet-users+unsubscribe@googlegroups.com.
For more options, visit this group at