On Thursday, February 15, 2018 at 4:41:59 AM UTC-6, buoyant_puppy wrote:
>
> I think I got this. My main issue was the 'true' logic with an 'onlyif', 
> because that's always only going to either run (= and therefore meet the 
> requirement) or not run at all (= which also meets the requirement since 
> it's not a failure).
>
>

Yes, I think that covers it.

 

> I feel the choice of words here leaves room for confusion. Like 
> "unless"... unless succeeds? unless fails? "requires" also leaves some 
> amgiuity as well, since it considers the requirement met as long as the 
> required resource did not explicitly return a failure. So "notrun" is just 
> as good as success, which to me doesn't really intuitively match what I 
> think "require" means.
>
>

This has been a point of confusion with the Exec resource type for the 
whole nine-ish years that I have been involved with Puppet.  Maybe it's 
time to actually file an issue against the docs to get it cleaned up.

But I don't think it's an issue with the metaparameter names.  Rather, it's 
a problem with the overall characterization of an Exec resource, which is 
not well addressed by the current docs.  I most recently answered 
essentially this same question over at StackOverflow 
<https://stackoverflow.com/questions/48512812/puppet-service-should-be-stopped-only-if-file-exists/48526033#48526033>.
  
Here's the heart of it:

Like any other resource, Execs model target-machine state, though in their 
case, that state is local to the context of one catalog run. Often it is 
described as whether the Exec's command has been run or not, but it is 
better characterized the other way around, as whether the Exec's command *needs 
to be run* or not. If it is in the "needs to be run" state then 
successfully executing the Exec's command transitions it to the "does not 
need to be run" state.


The unless, onlyif, and creates properties of an Exec serve to determine 
the initial state of the corresponding physical (so to speak) resource. If 
none of them are provided then the physical resource is initially in the 
"needs to be run" state. If one or more of them is provided then they may 
indicate that the Exec initially is in the "does not need to be run" state. 
*And 
that's the target state*. In that case, then, the Exec is successfully 
applied without running its command.


I've given substantially the same answer before in this group, too.


John

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/9aae3af2-e0a4-4198-bb4a-cace26dd7d01%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to