I started out with rails+emacs as a a data_bag name:
cat data_bags/sputnik_profiles/rails+emacs.json
{
"id": "rails+emacs",
"packages": [
"rails",
"emacs-goodies-el",
"emacs23"
]
}
chef-solo -j drive_this_train.json
FATAL: Chef::Exceptions::InvalidDataBagItemID: Data Bag items must have an id matching /^[\-[:alnum:]_]+$/, you gave: "rails+emacs"
So I renamed the file, but forgot to rename the id:
mv data_bags/sputnik_profiles/rails+emacs.json data_bags/sputnik_profiles/rails-emacs.json
chef-solo -j drive_this_train.json
FATAL: Chef::Exceptions::ValidationFailed: Data Bag Items must contain a Hash or Mash!
I futzed around with trying to make valid json that resulted in Hash or Mash.... before I found my error.
head -4 cache/chef-stacktrace.out
Chef::Exceptions::ValidationFailed: Data Bag Items must contain a Hash or Mash!
/opt/opscode/embedded/lib/ruby/gems/1.9.1/gems/chef-0.10.10/lib/chef/data_bag_item.rb:107:in `raw_data='
/opt/opscode/embedded/lib/ruby/gems/1.9.1/gems/chef-0.10.10/lib/chef/data_bag_item.rb:160:in `from_hash'
/opt/opscode/embedded/lib/ruby/gems/1.9.1/gems/chef-0.10.10/lib/chef/data_bag_item.rb:202:in `load'
data_bag_item.rb:107 -
unless new_data.respond_to?(:[]) && new_data.respond_to?(:keys)
raise Exceptions::ValidationFailed, "Data Bag Items must contain a Hash or Mash!"
endI wish the error was Chef::Exceptions::InvalidDataBagItemID rather than the Hash or Mash Validation error.