[chef] Bail out of a recipe?


Chronological Thread 
  • From: "Leinartas, Michael" < >
  • To: " " < >
  • Subject: [chef] Bail out of a recipe?
  • Date: Thu, 18 Nov 2010 01:35:47 -0600
  • Accept-language: en-US
  • Acceptlanguage: en-US

Title: Bail out of a recipe?
Is there a way to cleanly bail out of a recipe?  Here's a case:  our base recipe includes a syslogng client recipe that sends logs to the master log server for an environment.  It uses the search api to grab nodes that match the syslogng server recipe and the environment. While creating a new environment or in environments where no log server exists (dev envs), this wont match anything and that's a normal case, or a warning at most.

Currently in cases like this I have to wrap all of the logic in an if statement which kindof sucks.  Is there a clean way to just bail out?

if <some condition fails>
  bail "Gotta go!"
end
<actual recipe>
...

By clean I mean that the chef run is successful, no stacktrace, etc.



Archive powered by MHonArc 2.6.16.

§