[chef] with brackets: error Data Bag Items must contain a Hash or Mash


Chronological Thread 
  • From:
  • To: chef < >
  • Subject: [chef] with brackets: error Data Bag Items must contain a Hash or Mash
  • Date: Thu, 25 Aug 2011 12:46:33 -0700


hello. i was just struggling a big getting a data bag to upload. i
made a small modification to the json, and now it works, and i'm
wondering why this is.

i grabbed the example json from a blog post,
http://www.themomorohoax.com/2010/07/31/ruby-chef-tutorial

the json fails for me:

zahadum:~/sbox/ops/chef-repo$ knife data bag from file users37 
data_bags/users37/ops.json
ERROR: Chef::Exceptions::ValidationFailed: Data Bag Items must contain a Hash 
or Mash!

zahadum:~/sbox/ops/chef-repo$ cat data_bags/users37/ops.json
[
  {
    "id": "kallen",
    "groups": [
      "admin"
    ],
    "uid": 666,
    "local_files": true,
    "full_name": "kallen",
    "shell": "/bin/bash",
    "ssh_key": "ssh-rsa AAAA[snip for brevity]4drMA",
    "password": "$1$8dootdootdootdoot"
  } 



i remove the surrounding brackets in that json file for shiggles.
and then the data bag uploads fine:

zahadum:~/sbox/ops/chef-repo$ knife data bag from file users37 
data_bags/users37/ops.json 
Updated data_bag_item[users37::kallen]


why is that?

thanks in advance,
kallen





Archive powered by MHonArc 2.6.16.

§