[chef] Re: How to mark a ruby_block as failed?


Chronological Thread 
  • From:
  • To:
  • Subject: [chef] Re: How to mark a ruby_block as failed?
  • Date: Tue, 21 Dec 2010 20:29:48 +0000
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=x-rim-org-msg-ref-id:message-id:content-transfer-encoding:reply-to :x-priority:sensitivity:importance:subject:to:from:date:content-type :mime-version; b=jR5rzDXmTJRG/s1vjfzRDLne+wsCVIeutgOz3ksmPIvmtWXxG8x/4oKwFfSi7MNJvP 7GxjaTgp47deeJqaFtIDpFkpFwXWfTa8m0zM9DgBLPVrAP7xrPmt0qlaIWB+Q9cDfmqX xtdw5VJy4/BIsHQ41Ut0vUwZ71cS2Vsvo/JQk=
  • Importance: Normal
  • Sensitivity: Normal

This seems like it would be better solved in a lwrp, lib or straight up 
provider,  but u should be able to throw a Chef::Exception in the ruby block. 
------Original Message------
From: Jonathan Weiss
To: 

ReplyTo: 

Subject: [chef] How to mark a ruby_block as failed?
Sent: Dec 21, 2010 12:20 PM

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


Sent via BlackBerry from T-Mobile

  • [chef] Re: How to mark a ruby_block as failed?, spheromak, 12/21/2010

Archive powered by MHonArc 2.6.16.

§