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


Chronological Thread 
  • From: David Montgomery < >
  • To:
  • Subject: [chef] NoMethodError - undefined method `[]' for nil:NilClass
  • Date: Wed, 17 Jul 2013 07:00:06 +0800

Hi,

How do I prevent the below from happening?  I thought given the below logic it will always work.

I am trying to set  node['kafka']['brokerid'] only once.  How do I get NoMethodError?

44: 
 45>> if node['kafka']['brokerid'].nil?
 46:    node.set['kafka']['brokerid'] = Time.now.getutc.to_i
 47:  end
 48:  brokerid = node['kafka']['brokerid']
 49:   
 50:  template "/var/lib/kafka-0.7.2-incubating-src/config/server.properties" do
 51:    path "/var/lib/kafka-0.7.2-incubating-src/config/server.properties"
 52:    source "server.properties.erb"
 53:    owner "root"
 54:    group "root"



[2013-07-16T22:48:42+00:00] DEBUG: Re-raising exception: NoMethodError - undefined method `[]' for nil:NilClass




Archive powered by MHonArc 2.6.16.

§