[chef] Could the resource guard documentation be clarified?


Chronological Thread 
  • From: Joe Nuspl < >
  • To: " " < >
  • Subject: [chef] Could the resource guard documentation be clarified?
  • Date: Wed, 4 Mar 2015 10:27:56 -0800

I recently helped a colleague through some confusion about how multiple guards worked.

Greatly simplifying the code, the recipe looked like:

file '/foo/bar' do
  only_if { true }
  only_if { false }
end

The chef code treats these as OR while they thought it was AND.

We remedied the situation be changing it to:

file '/foo/bar' do
  only_if do
    true && false
  end
end

While this case was straight forward, there is another case where chef-rewind is being used to add an additional clause.  This will be more challenging.

So...

Is OR the correct behavior?  Or should it be AND? Or do people not use multiple guards?


Thanks.

Joe




Archive powered by MHonArc 2.6.16.

§