On Friday, August 17, 2012 11:23:46 AM UTC-5, Douglas wrote:
>
> When chaining execs together, and wanting to ensure that exec 
> resources are not executed on every puppet run, which method is 
> better? Using unless/onlyif or subscribe/refreshonly? 
>
> With unless/onlyif, the exec is evaluated every time. With 
> subscribe/refreshonly, the exec is only executed when a dependent 
> resource changes.... 
>


Neither mechanism is better than the other in any general sense.  They 
serve different purposes, and it is uncommon that both are applicable to 
any given configuration objective.

The 'unless' and 'onlyif' (and 'creates') parameters serve as means for an 
Exec to determine whether it is already in sync.  If it is, then its 
command will not be run, in the same way that a File that is already in 
sync will not redundantly download its content.  This should also have 
implications for reports, etc..  The 'unless' and/or 'ifonly' commands must 
run every time, though.

The 'refreshonly' parameter, on the other hand, makes application of the 
Exec conditional on (and subsequent to) one or more other resources 
changing, sort of like an 'on update' trigger in a database.

In any given case, you should use whichever approach makes sense.


John

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/puppet-users/-/ogvL-ymc10sJ.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to