[chef] Re: Re: Re: Why does my run fail wheh I use ignore_failure true?


Chronological Thread 
  • From: "steve ." < >
  • To: " " < >
  • Subject: [chef] Re: Re: Re: Why does my run fail wheh I use ignore_failure true?
  • Date: Mon, 5 Aug 2013 10:19:32 -0700

To answer the larger question, "Why does my Chef run fail if I set ignore_failure to true on a resource?"

Chef runs will fail if an exception is raised.  Exceptions can be raised within a resource provider, or they can be raised in the Ruby code you write in between declaring resources.

Common culprits (in my experience):
 * Making assumptions about nested node data being present.  (For example, 'if node[:foo][:bar] == "baz"' fails because node[:foo] isn't defined)
 * Running external code (including Chef searches and data bag lookups!) without a rescue block.
 * Attempting to load a gem that isn't installed on the system (yet, or ever).

Foodcritic rules for these situations would be awesome and I'd love to write them, but looking into the inner workings of the Ruby AST parser code gives me a serious case of brain-fry every time...

Hope this helps the OP understand the general situation (or, failing that, helps someone Googling this question :D ) ...



On Mon, Aug 5, 2013 at 8:14 AM, Daniel DeLeo < " target="_blank"> > wrote:
On Monday, August 5, 2013 at 7:40 AM, Andrew Gross wrote:
Can you paste a larger snippet of the failed run?  It is possible it is failing when it is parsing the code, not when it is running it, however it is hard to tell from this message.
This is definitely the case: 
(snip…)
ec2-54-215-148-92.us-west-1.compute.amazonaws.com   8>> aws_resource_tag node['ec2']['instance_id'] do\
Your error is in the compile phase right there. Probably you're on VPC or a new EC2 account that is "VPC-ish", so ohai can't automatically detect EC2.

And, when the ticket system comes back, see OHAI-310.

To create the ec2 "hint", create /etc/chef/ohai/hints/ec.json (doesn't need any content). The knife-ec2 plugin does this automatically, if you're using a different provisioning workflow, you'll probably want to add a step to create that file.

-- 
Daniel DeLeo





Archive powered by MHonArc 2.6.16.

§