- From: Joshua Timberman <
>
- To: "
" <
>
- Subject: [chef] Re: Can't rescue from a 'package' resource call
- Date: Mon, 26 Nov 2012 00:23:45 +0000
- Accept-language: en-US
Ohai,
On 11/25/12 4:37 PM, "Marcelo de Moraes Serpa"
<
>
wrote:
>
I'm trying to ignore the Chef::Exceptions::Package exception from
>
breaking the cook process by wrapping the package method call in a
>
begin;rescue, and rescuing from the Chef::Exceptions::Package exception,
>
but even so, when the package is not present, it just breaks. Am I doing
>
anything wrong? Here's the code:
>
>
%w( wget zlib1g-dev libssl-dev libffi-dev libxml2-dev libncurses5-dev
>
libreadline5-dev libreadline-dev ).each do |pkg|
>
begin
>
package pkg do
>
action :install
>
end
If it actually is okay for the package to not be installed and the rest of
the Chef run can be finished without issue, then you can use the
ignore_failure parameter.
package pkg do
ignore_failure true
action :install
end
It's available to any resource, like notifies, subscribes, etc. Use this
parameter sparingly though.
http://docs.opscode.com/resource_common.html
--
Opscode, Inc
Joshua Timberman, Technical Community Manager
IRC, Skype, Twitter, Github: jtimberman
Archive powered by MHonArc 2.6.16.