Adoptable Cookbooks List

Looking for a cookbook to adopt? You can now see a list of cookbooks available for adoption!
List of Adoptable Cookbooks

Supermarket Belongs to the Community

Supermarket belongs to the community. While Chef has the responsibility to keep it running and be stewards of its functionality, what it does and how it works is driven by the community. The chef/supermarket repository will continue to be where development of the Supermarket application takes place. Come be part of shaping the direction of Supermarket by opening issues and pull requests or by joining us on the Chef Mailing List.

Select Badges

Select Supported Platforms

Select Status

RSS

data-bag-cache (3) Versions 0.1.1

Installs/Configures data-bag-cache

Policyfile
Berkshelf
Knife
cookbook 'data-bag-cache', '= 0.1.1', :supermarket
cookbook 'data-bag-cache', '= 0.1.1'
knife supermarket install data-bag-cache
knife supermarket download data-bag-cache
README
Dependencies
Quality 0%

data-bag-cache

About

Description

Temporarily caches Chef data bag items in an attribute to speed up chef-client runs.

Author

Getting Started

Installation

Utilization

To use this cookbook, first ensure that you have added depends "data-bag-cache" to your metadata.rb. Once your cookbook is dependent on data-bag-cache you can cache data bag items using the data_bag_cache_items LWRP. The resources available to the LWRP are listed below:

  • name (required) - name and location of the cached data bag items (name attribute).
  • data_bag (optional) - name of the data bag. Defaults to name if not provided.
  • search (optional) - a custom search query which will be executed when getting data bag items. Defaults to nil.
  • cache_disabled (optional) - When true, calls to the data_bag_cache_items LWRP will bypass local cache, and will always perform a new search. Defaults to false.

The actions available for this LWRP are listed below:
* :nothing do nothing

To access cached data bag items, simply reference the node attribute storing the items. Your items will be located at node['data-bag-cache'][lwrp_name_attribute].

Examples

Get all items in the users data bag:
ruby
data_bag_cache_items "users"

Get all items in the users data bag where the sysadmin group is present:
ruby
data_bag_cache_items "users" do
search "group:sysadmin"
end

Get all items in the users data bag where the shell is /bin/zsh:
ruby
data_bag_cache_items "zsh_users" do
data_bag "users"
search "shell:/bin/zsh"
end

Get all items in the users data bag, ensuring it is the most up to date list (not serving a cached copy from earlier in the run):
ruby
data_bag_cache_items "users" do
cache_disabled true
action :nothing
end

Iterating over all items in the users data bag:
ruby
node['data-bag-cache']['users'].each do |user|
puts user.to_json
end

Dependent cookbooks

This cookbook has no specified dependencies.

Contingent cookbooks

There are no cookbooks that are contingent upon this one.

Foodcritic Metric
            

0.1.1 failed this metric

FC003: Check whether you are running with chef server before using server-specific features: /tmp/cook/4ec7e08ed7d6b8552ab00ac2/data-bag-cache/providers/items.rb:19
FC003: Check whether you are running with chef server before using server-specific features: /tmp/cook/4ec7e08ed7d6b8552ab00ac2/data-bag-cache/providers/items.rb:28