Douglas Garstang
2012-Aug-17 16:23 UTC
[Puppet Users] Unless/Onlyif vs Subscribe/Refreshonly
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.... Doug. -- 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 http://groups.google.com/group/puppet-users?hl=en.
jcbollinger
2012-Aug-17 21:01 UTC
[Puppet Users] Re: Unless/Onlyif vs Subscribe/Refreshonly
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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Douglas Garstang
2012-Aug-17 21:23 UTC
Re: [Puppet Users] Re: Unless/Onlyif vs Subscribe/Refreshonly
On Fri, Aug 17, 2012 at 2:01 PM, jcbollinger <John.Bollinger@stjude.org> wrote:> > > 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.I think...and I might be wrong because I''m a little sleep deprived today, that it seems like you just said the same thing twice... Doug. -- 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 http://groups.google.com/group/puppet-users?hl=en.