[chef] Re: How to execute a command block only if previous block succeed?


Chronological Thread 
  • From: Ranjib Dey < >
  • To:
  • Subject: [chef] Re: How to execute a command block only if previous block succeed?
  • Date: Mon, 20 May 2013 11:51:52 -0700

in chef resources are executed in the same order as they are written in the recipe. also if one of them is borked the entore chef run will bomb. This is the default way and you can change the ordering using notify/subscribe and also ignore any resource's failure using the ignore_failure meta attribute.
So, what you have asked should be doable by vanilla chef run, without any foo, assuming your lwrp provider throws exception when its not able to do the job.
Also if you think the sole purpose of the execute block is tied with the lwrp, you might pull it down in your provider itself, (may be in a separate action),


On Mon, May 20, 2013 at 10:22 AM, howard chen < " target="_blank"> > wrote:
I have written a custom provider, foo

action :helloworld do
...
end

And in my recipe, I have lines..

foo "bar" do
  action : helloworld
end

..
..
execute "bye" do
  command "xxx"
  action :run
end

How to make my last execute block run only if my custom provider "foo" is executed correctly?

i.e. How to make my helloworld action return success/error status and such that the later block can make use of this value?


Thanks.




Archive powered by MHonArc 2.6.16.

§