Skip to content

Instantly share code, notes, and snippets.

@adamhjk
Created October 5, 2010 18:16
Show Gist options
  • Select an option

  • Save adamhjk/612039 to your computer and use it in GitHub Desktop.

Select an option

Save adamhjk/612039 to your computer and use it in GitHub Desktop.
require 'chef'
require 'chef/data_bag'
require 'chef/data_bag_item'
bag = Chef::DataBag.load("yourbag")
# The "true" here just inflates them to the data bag items
bag.list(true).each do |item|
item["poop"] = "smith"
item.save
end
# Or
item = Chef::DataBagItem.load("yourbag", "key")
item["snarf"]
item.save
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment