Issue #10063 has been updated by Felix Frank.

I believe this is an inherent problem with the exec provider, not cron.

Most providers try and initialize themselves when the agent (or apply) run 
initializes. Resources are being prefetched.

Exec has no prefetch. It may even be possible to implement that, so that all 
unless/onlyif clauses are evaluated during initialization, but that would not 
only be silly, it would lead to unexpected results when there are exec's that 
are ordered and can influence each other.

Thus, I think this shouldn't be fixed, though confusing it may seem.

After all, it's a minor semantic error to manage the same crontab through two 
different providers.

----------------------------------------
Bug #10063: cron resource violates resource ordering
https://projects.puppetlabs.com/issues/10063#change-87260

* Author: Igor .
* Status: Accepted
* Priority: Normal
* Assignee: 
* Category: cron
* Target version: 
* Affected Puppet version: 2.7.3
* Keywords: cron ordering parsedfile
* Branch: 
----------------------------------------
Consider the following class
<pre> 
class broken_cron {
        cron { 'myjob':
                command => "/usr/local/sbin/myjob",
                user => root,
                minute => "22"
                hour => "5"
                ensure => present
        }
 
        # Try and cleanup crontab -- this is broken in a rather surprising way!
        
        exec { 'crontab -l|grep -v myjob|crontab -':
                unless => "crontab -l|grep '^# Puppet Name: myjob'",
                path => "/bin:/usr/bin",
                before => Cron['myjob']
                }
 
}
</pre>

if this applied when crontab already contains myjob but with different time 
settings than specified in the cron resource, crontab will end up containing 
the job twice. It seems cron type is prefetching the contents of crontab before 
the exec runs despite the explicit ordering.


-- 
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.


Reply via email to