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


Chronological Thread 
  • From: Denis Barishev < >
  • To:
  • Subject: [chef] Re: Re: Re: Re: debugging chef run.--print to screen
  • Date: Mon, 17 Feb 2014 16:54:06 +0700

Yeah,

try
puts "-------------------------------------"
puts "#{node.chef_environment"

otherwise it will be in your log if you use Chef::Log.info for example.

On 17/02/14 16:32, David Montgomery wrote:
" type="cite">
I tied 
bellow is output of logging.

log "#{node.environment}"
log "#{node.chef_environment}"

 20:  log "#{node.environment}"
 21:  log "#{node.chef_environment}"


where is the output?  I thought would print to screen



On Mon, Feb 17, 2014 at 5:24 PM, Denis Barishev < " target="_blank"> > wrote:
Hi,

try node.chef_environment.



On 17/02/14 16:12, Daniel Condomitti wrote:
Look into Chef::Log; you may want to leave a lot of debug messages in even once this is resolved.

Also, that monitor_server executes every time (during the compilation phase) even if location isn't set in the above if block. Where does the db hash come from?


On Feb 17, 2014, at 1:05 AM, David Montgomery < " target="_blank"> > wrote:

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.

§