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
bail "Gotta go!"
end

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

return works

On Nov 17, 2010, at 11:35 PM, Leinartas, Michael wrote:

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
bail "Gotta go!"
end

...

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