[chef] What is wrong with my data bag?


Chronological Thread 
  • From: David Montgomery < >
  • To:
  • Subject: [chef] What is wrong with my data bag?
  • Date: Tue, 17 Apr 2012 20:05:04 +0800

Hi,

I am trying to use a data bag for the first time.  I is uploaded in my
hosted chef account.

Here is the error I get in a chef-client run.

 information to /var/chef/cache/failed-run-data.json
[Tue, 17 Apr 2012 11:59:35 +0000] ERROR: Exception handlers complete
[Tue, 17 Apr 2012 11:59:35 +0000] ERROR: NoMethodError: undefined
method `[]' for nil:NilClass
[Tue, 17 Apr 2012 11:59:35 +0000] FATAL: Stacktrace dumped to
/var/chef/cache/chef-stacktrace.out
[Tue, 17 Apr 2012 11:59:35 +0000] ERROR: Sleeping for 30 seconds
before trying again


Here is my databag in rtb_data_bags/rtb.json

{
        "id": "rtb",
        "production":{
                                "monitor":{
                                                   
"ip_address":"xxx.xxx.xxx.xxx"
                                              }
                                 },
        "developent":{
                                "monitor":{
                                                   
"ip_address":"xxx.xxx.xxx.xxx"
                                              }
                                 }
        
}

Here is how I use in a recipe;

data_bag("rtb_data_bag")
db = data_bag_item("rtb_data_bag", "rtb")
monitor_ip_address = db['development']['monitor']['ip_address']

Where did I err?



Archive powered by MHonArc 2.6.16.

§