Issue #4820 has been updated by Felix Frank.
I poked around in this issue. Turns out there's what I perceive to be an actual
bug.
This is what I produced with master:
<pre>
$ crontab -l
# HEADER: This file was autogenerated at Sun Feb 24 01:02:48 +0100 2013 by
puppet.
# HEADER: While it can still be managed manually, it is definitely not
recommended.
# HEADER: Note particularly that the comments starting with 'Puppet Name' should
# HEADER: not be deleted, as doing so could cause duplicate cron jobs.
# Puppet Name: unusual
1 23 * * * /bin/date
$ RUBYLIB=lib puppet apply -e 'cron { "unusual": user => "ffrank", special =>
"reboot", ensure => present, command => "/bin/date" }'
Notice: Finished catalog run in 0.21 seconds
$ crontab -l
# HEADER: This file was autogenerated at Sun Feb 24 01:02:48 +0100 2013 by
puppet.
# HEADER: While it can still be managed manually, it is definitely not
recommended.
# HEADER: Note particularly that the comments starting with 'Puppet Name' should
# HEADER: not be deleted, as doing so could cause duplicate cron jobs.
# Puppet Name: unusual
1 23 * * * /bin/date
</pre>
What happens is: An existing entry with at least one schedule field filled is
not replaced by the special schedule.
I haven't looked at the code, but I suspect it works as designed: If any of the
fields are *not* absent, ignore the special schedule.
Which is pretty horrible and not what a user would expect, I think.
I've got a proposal for implementing the original requested feature on the
slate. I shall propose a fix for this problem as well.
----------------------------------------
Feature #4820: cron type should not allow specification of special parameter
and normal hour/minute/day/etc parameters.
https://projects.puppetlabs.com/issues/4820#change-84028
Author: micah -
Status: Accepted
Priority: Normal
Assignee: Nigel Kersten
Category: cron
Target version:
Affected Puppet version:
Keywords: cronfixit
Branch:
As it is now, if you specify a 'special' parameter to the cron provider, while
*also* providing other hour/minute/day/etc parameters, only the special
parameter is applied:
<pre>
# cat /tmp/test_special_cron.pp
cron { "test_special":
command => "/bin/true",
hour => "*/6",
special => "reboot";
}
# puppet /tmp/test_special_cron.pp
notice: /Stage[main]//Cron[test_special]/ensure: created
# crontab -l
# HEADER: This file was autogenerated at Wed Sep 22 11:02:54 -0400 2010 by
puppet.
# HEADER: While it can still be managed manually, it is definitely not
recommended.
# HEADER: Note particularly that the comments starting with 'Puppet Name' should
# HEADER: not be deleted, as doing so could cause duplicate cron jobs.
# Puppet Name: test_special
@reboot /bin/true
</pre>
You will notice that *only* the "@reboot" line was added, when I clearly also
specified "hour => */6".
Since cron specials typically do not conflict with a regular cron entry, I was
expecting two cron entries to be made, one for the @reboot, and one for the */6
hourly.
I can understand the argument that you might want people explicitly specify
separate cron resources, and not let people do this. If that is what you
prefer, then I would change my bug report to request that you notify the user
somehow that they've specified a parameter that will not be applied.
--
You have received this notification because you have either subscribed to it,
or are involved in it.
To change your notification preferences, please click here:
http://projects.puppetlabs.com/my/account
--
You received this message because you are subscribed to the Google Groups
"Puppet Bugs" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/puppet-bugs?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.