[chef] debugging chef run.--print to screen


Chronological Thread 
  • From: David Montgomery < >
  • To:
  • Subject: [chef] debugging chef run.--print to screen
  • Date: Mon, 17 Feb 2014 17:05:24 +0800

Hi,

I am gettng the below error.  I need to debug. 


I should have values in the json object: monitor_server = db[node.environment][location]['monitor']['ip_address']

How do I print to the scren  values so i can see why chef is not working.  undefined method `[]' for nil:NilClass is useless for me.  Is it because of location? because of node.environment?

I would to print to screen e.g, print node.environment



================================================================================
Recipe Compile Error in /var/chef/cache/cookbooks/environment/recipes/remote_meta.rb
================================================================================


NoMethodError
-------------
undefined method `[]' for nil:NilClass


Cookbook Trace:
---------------
  /var/chef/cache/cookbooks/environment/recipes/remote_meta.rb:18:in `from_file'


Relevant File Content:
----------------------
/var/chef/cache/cookbooks/environment/recipes/remote_meta.rb:

 11:  end
 12:  if node.name.include? "X"
 13:    datacenter = node.name.split('X')[0]
 14:    server_type = node.name.split('X')[1]
 15:    location = node.name.split('X')[2]
 16:  end
 17: 
 18>> monitor_server = db[node.environment][location]['monitor']['ip_address']
 19: 
 20: 
 21:  if datacenter != "aws"
 22:    directory "/home/ubuntu" do
 23:      owner "root"
 24:      group "root"
 25:      mode "0777"
 26:      action :create
 27:    end




Archive powered by MHonArc 2.6.16.

§