chef-boneyard / chef-vault

chef-vault cookbook
https://supermarket.chef.io/cookbooks/chef-vault
Apache License 2.0
60 stars 53 forks source link

List Vault Items within recipe #66

Closed saidmasoud closed 6 years ago

saidmasoud commented 6 years ago

Is there a way to perform the rough equivalent of knife vault show VAULT within a recipe? I would like to build a list of all items, then iterate over that list to do what I need to do with the data in each item. If not, I would like to submit this as a feature request.

thommay commented 6 years ago

A vault is just a data bag, so you can use the method in https://docs.chef.io/dsl_recipe.html#data-bag to iterate, and then chef_vault_item rather than data_bag_item

saidmasoud commented 6 years ago

Calling data_bag() on a vault returns the ids of both the items and their associated keys, which forces users to check whether the current item being iterated over is the key or the item itself. I think a helper method that only returned the items in a vault would be a much cleaner implementation.

thommay commented 6 years ago

If you'd like to submit a PR to do this we'd definitely take it.