- From: Joshua Timberman <
>
- To: "
" <
>
- Subject: [chef] Re: How to mark a ruby_block as failed?
- Date: Wed, 22 Dec 2010 08:27:39 -0700
Hi there!
You can use execute and other resources in ruby_block. It requires setting
the runcontext. I'll paste some code when I get back to my desk.
On Dec 21, 2010, at 1:20 PM, Jonathan Weiss
<
>
wrote:
>
Cheers,
>
>
>
I'm using a ruby_block to handle complex operations with mdadm in
>
Chef. My question is, how do I tell Chef that my block failed and
>
execution should halt with an error? In pseudo code:
>
>
ruby_block "A complex operation" do
>
block "using mdadm" do
>
output = `do something`
>
if $?.success?
>
Chef::Log.info output
>
else
>
Chef::Log.error output
>
# tell chef we failed
>
end
>
end
>
end
>
>
This would of course be easier if I could just use the execute
>
resource in the ruby_block...
>
>
Thanks,
>
Jonathan
>
>
--
>
Jonathan Weiss
>
http://blog.innerewut.de
>
http://twitter.com/jweiss
Archive powered by MHonArc 2.6.16.