1

I'm having hard time to create data bags using ridley gem. My json file looks like below

{
  "name": "users",
  "json_class": "Chef::DataBagItem",
  "chef_type": "data_bag_item",
  "data_bag": "databag_name",
  "raw_data": {
    "id": "users",
    "list": {
      "user1": {
        "password": "<%= password %>",
        "permission": "readwrite"
      },
      "user2": {
        "password": "<%= password %>",
        "permission": "readonly"
      },
      "user3": {
        "password": "<%= password %>",
        "permission": "readwrite"
      }
    }
  }
}

I'm trying to create it using ridley.data_bag.from_json method but it creates a empty databag without any items.

I'm having hard time to find the data bag as well. ridley.data_bag.find("databag_name") it is returning a empty object

=> #<Ridley::DataBagObject chef_id:, attributes:#<VariaModel::Attributes name=nil>>

I know that the data bag exists in chef server and I can read it using knife.

Ram
  • 324
  • 1
  • 4
  • 21
  • Could you post your code snippet? Have you tried to create data bag and items separately? Like [described in documentation](https://github.com/berkshelf/ridley#data-bag-resource)? – Szymon Jan 25 '17 at 06:20
  • Databag already exists in chef server....I want to find the databag and insert items in it...However I cannot find the data bag using ridley.data_bag.find("databag_name") – Ram Jan 25 '17 at 18:05

0 Answers0