berkshelf / ridley

A reliable Chef API client with a clean syntax
Other
231 stars 84 forks source link

Nested databag object #279

Closed evalencia closed 9 years ago

evalencia commented 10 years ago

Hi all,

I wanted to know if nested items are supported, the reason that I ask this is when I do an update my nested object gets wiped out to a flat object.

I have a data bag called artifacts, then we have the items of apache.

knife data bag show artifacts nginx apache

knide data bag show artifacts apache environment: development: version: 6 staging: version: 2 id: apache

When I do an update with the following line my nested data is gone: data_bag.item.update(id: "apache", environment: "staging", version: "20")

knife data bag show artifacts apache environment: staging id: apache version: 20

If this is the wrong way of doing it? If so could you someone post an example please. Thanks ev-

sethvargo commented 9 years ago

Hi @evalencia,

Your code formatting did not preserve in GitHub, but Chef does not support "nested" data bags. Data bags are a container of data bag items, and they are just JSON. You can think of a data bag as a folder and a data bag item as a .json file that lives in that folder.