- From: Daniel Condomitti <
>
- To:
- Subject: [chef] Re: Re: Re: Really? What am I missing?
- Date: Fri, 7 Dec 2012 12:34:18 -0800
You can also do the same thing with shef and isolate individual recipes.
http://wiki.opscode.com/display/chef/Shef
http://www.juliandunn.net/2012/10/19/an-introduction-to-shef-the-chef-shell/
http://stevendanna.github.com/blog/2012/01/28/shef-debugging-tips-1/
https://github.com/bryanwb/chef-rewind
On Friday, December 7, 2012 at 10:33 AM, Brasic, Carl wrote:
>
One thing I find helpful when debugging these sort of issues is pry[1].
>
>
If the node you're running chef-client on has the pry gem installed
>
and available to chef, you can just include
>
>
require 'pry'
>
binding.pry
>
>
in your recipe wherever you want to set up a breakpoint -- when
>
chef-client runs, you get dropped into an irb-like shell at that point
>
in the code where you can inspect variables like node and run
>
arbitrary code in the context of the compile phase (or in execute
>
phase if you invoke pry in a ruby_block). Type 'exit' and the chef
>
run will continue. You can even do things like update the node
>
variable to test that some change you might later make in
>
attributes.rb will work.
>
>
It's much more convenient than the debug statement/re-upload
>
strategy that I was using before.
>
>
Carl
>
>
[1] https://github.com/pry/pry
>
>
On Thu, Dec 6, 2012 at 11:53 PM, Warren Bain
>
<
>
>
(mailto:
)>
>
wrote:
>
> Mark,
>
>
>
> As a chef n00b I get lots of these. The attribute you are referencing
>
> doesn't exist and so node[:sgbase] which is nil doesn't have a method
>
> [:branch]. Hence the slightly confusing error.
>
>
>
> Wazza
>
>
>
>
>
> Warren Bain
>
> http://ninefold.com
>
> Australia's cloud
>
> direct: +61 2 8221 7729
>
> mobile: +61 414 867 559
>
> follow: http://twitter.com/thoughtcroft
>
>
>
> Mark J Bradakis
>
> <
>
>
>
> (mailto:
)>
>
> wrote:
>
> So I get this error:
>
>
>
> NoMethodError
>
> -------------
>
> undefined method `[]' for nil:NilClass
>
>
>
>
>
> Which comes from this line:
>
>
>
> 627>> revision node[:sgbase][:branch]
>
>
>
> Called by a recipe in a file that does this:
>
>
>
> "cookbook_versions": {
>
> "cpan": "= 1.0.0",
>
> "apt": "= 1.0.0",
>
> "sgbase": "= 1.0.0",
>
> "branch": "= 1.0.0"
>
> ...
>
>
>
>
>
> sgbase and branch ARE defined - why the NULL error?
>
>
>
>
>
> mjb.
Archive powered by MHonArc 2.6.16.