Weekly parameter for the cron resource behaves differently with future parser

38 views
Skip to first unread message

Peter Van Biesen

unread,
Jul 16, 2014, 11:03:19 AM7/16/14
to puppet...@googlegroups.com
Hi,

I just ran into an issue with the future parser. I had following statement in my manifests :

cron {'zorgregieRapportering':
      command => "/usr/projects/admintools/cronWrap.bash -s /home/weblogic/JOB/rapporten/zorgregieRapportering.bash",
      ensure => present,
      user => weblogic,
      minute => '00',
      hour => 1,
      weekday => [1-5],
     }

This would work fine with the old parser but no longer works with the future parser. It gives an error that "-4 is not a valid weekday" .

I was just wondering why it did work in the old parser. Did the old parser expand this as a range or just assume this to be a string ?

Thanks in advance,

Petet.
PS: I fixed it by putting weekday => '1-5'


Raadpleeg uw VAPH-dossier online via http://mijn.vaph.be.
---------------------------------------------------------------------------------
http://www.vaph.be/disclaimer

David Schmitt

unread,
Jul 21, 2014, 2:23:38 AM7/21/14
to puppet...@googlegroups.com, Henrik Lindberg
On 2014-07-16 17:03, Peter Van Biesen wrote:
> Hi,
>
> I just ran into an issue with the future parser. I had following
> statement in my manifests :
>
> cron {'zorgregieRapportering':
> command => "/usr/projects/admintools/cronWrap.bash -s
> /home/weblogic/JOB/rapporten/zorgregieRapportering.bash",
> ensure => present,
> user => weblogic,
> minute => '00',
> hour => 1,
> weekday => [1-5],
> }
>
> This would work fine with the old parser but no longer works with the
> future parser. It gives an error that "-4 is not a valid weekday" .
>
> I was just wondering why it did work in the old parser. Did the old
> parser expand this as a range or just assume this to be a string ?
>
> Thanks in advance,
>
> Petet.
> PS: I fixed it by putting weekday => '1-5'

The old parser most likely interpreted that as a string, while the new
one correctly recognized it as an arithmetic expression.

Henrik, you might want to look into that ;-)


Regards, David

Henrik Lindberg

unread,
Jul 21, 2014, 9:43:18 AM7/21/14
to puppet...@googlegroups.com
The current parser treats 1-5 as a bare-word (i.e. a NAME) which results
in a String when evaluated. That is deliberately changed in the future
parser, NAME can not start with a digit, and can not contain a
hyphen/minus. If you in the current parser write 1 - 5 (with spaces),
you get the same result as in the future parser (because NAME cannot
contain a space).

The source should be changed to '1-5' (as you did) and this will work in
both versions. In the future the correct evaluation of [1-5], is [-4]
(an array with a negative integer of value 4).

In general, it is important to use the correct notation to get string
values, if something looks like a number, then it will be used as a
number. If you want a string quote the value.

- henrik
--

Visit my Blog "Puppet on the Edge"
http://puppet-on-the-edge.blogspot.se/

Reply all
Reply to author
Forward
0 new messages