[chef] Re: Foce Exit Cleanly


Chronological Thread 
  • From: Daniel DeLeo < >
  • To:
  • Subject: [chef] Re: Foce Exit Cleanly
  • Date: Wed, 4 Sep 2013 08:59:52 -0700


On Wednesday, September 4, 2013 at 8:39 AM, Moser, Kevin wrote:

Have a use case where I want to let a node compile and then converge to a specific point in the resource collection and if that specific resource is hit (driven by compile time whether it gets put on the collection) I would like to basically "fast forward to the end" and not run any more resources.

I can do this with an error end by calling Chef::Application.exit! or Chef::Application.fatal! in a ruby_block resource but am wondering if there is a more elegant way to do this that doesn't cause a SystemExit error to be thrown and basically tells Chef to stop processing and move to the handlers.

It would basically have to be an exit point in the execute_each_resource method but not sure if such an exit point exists or if the SystemExit approach is the only way?

Thanks!

Kevin Moser
There isn't an elegant way to make chef skip to the end the way you want. You could raise a different exception type, which is maybe a little better than a SystemExit error.

Since your use-case is driven by compile-time logic, you could instead wrap calls to `include_recipe` with your conditional logic to include them or not as desired.

-- 
Daniel DeLeo




Archive powered by MHonArc 2.6.16.

§