On Thu, 15 Feb 2018, at 11:41, 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).
> 
> I feel the choice of words here leaves room for confusion. Like "unless"... 
> unless succeeds? unless fails? "requires" also leaves some amgiuity as 

"unless this thing is true" seems clear to me, also in line with how ruby works 
and also puppet

  if $thing { }
  unless $thing { }


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

require means the required resource is in the desired start.  Your desired 
state is not to run at certain times, the desired behavior was reached so the 
resource is in pass state.  require is a generic meta param that applies to all 
resources - it does not know the particulars of what you think a certain 
resource is doing, its at a higher level.

> 
> Here's a set of tests that illustrate all this more clearly, in case it 
> helps someone else that stumbles on this post:
>   exec { "test1": command => "/bin/false", unless => "/bin/true" }  # 
> unless = only if this fails
>   notify { "false, unless true fails, which it wont: this should not fail 
> (notrun) and i should see this": require => Exec["test1"] }
>   exec { "test2": command => "/bin/false", onlyif => "/bin/true" }   # 
> onlyif = only if this returns true
>   notify { "false, but only if true: this should fail and i should not see 
> this": require => Exec["test2"] }
>   exec { "test3": command => "/bin/true", unless => "/bin/true" } # unless 
> = only if this fails
>   notify { "true, unless true fails, which it wont: this should not run 
> true (notrun) and i should see this": require => Exec["test3"] }
>   exec { "test4": command => "/bin/true", onlyif => "/bin/false" } # onlyif 
> = only if this returns true
>   notify { "true, but only if false returns true, which it wont: true will 
> be run and i should see this": require => Exec["test4"] }
> 
> 
> -- 
> 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/e9c2a7a4-148b-4337-aba7-acf308e7cbe0%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.


-- 
R.I.Pienaar / www.devco.net / @ripienaar

-- 
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/1518692076.866186.1271713656.324BD46F%40webmail.messagingengine.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to