[chef] Exception handling for the Execute Resource


Chronological Thread 
  • From: Carl Perry < >
  • To:
  • Subject: [chef] Exception handling for the Execute Resource
  • Date: Thu, 19 Apr 2012 15:17:25 -0700
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=dreamhost.com; h=message-id:date :from:mime-version:to:subject:content-type; q=dns; s= dreamhost.com; b=dP2wxyR/PBeyxW6tuo6eZsU9m0W+/fLGQuyZpK64jtHQgRd L9WYd0mJBHpVm8dtNukktqjJWiAnuzgcx6LR/OEyvK0kpl7bYgl9x62N1B5GTnml OQSUwz7Lj6xlJQaE7T4ULglNT6i+3YFJGXxlPx8Yi2w4FpwpebvVzPijnm0Y=

Greetings!

I've got a situation where I'm iterating through a list and performing
operations on them.  One of these operations looks like this:

    execute "Format data device for #{osd_id} using XFS" do
      command "mkfs.xfs -f #{mkfs_opts} -L osd.#{osd_device['osd_id']}
#{osd_device['data_dev']}"
    end

What I would like to do is instead of aborting the entire chef run
because this failed, and instead mark it failed and move on to the next
one.  What is the best practice for catching an exception from an
execute resource and taking action instead of aborting?

Thanks!

  -Carl

Attachment: signature.asc
Description: OpenPGP digital signature




Archive powered by MHonArc 2.6.16.

§