cookbook 'data-bag-cache', '~> 0.2.0'
data-bag-cache (3) Versions 0.2.0 Follow1
Installs/Configures data-bag-cache
cookbook 'data-bag-cache', '~> 0.2.0', :supermarket
knife supermarket install data-bag-cache
knife supermarket download data-bag-cache
data-bag-cache
About
Description
Temporarily caches Chef data bag items in an attribute to speed up chef-client runs.
Author
- Norman Joyner - norman.joyner@gmail.com
Getting Started
Installation
Using Berkshelf: cookbook 'data-bag-cache', '~> 0.2.0'
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 toname
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.
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 "users"
Get all items in the users data bag where the sysadmin group is present:
ruby
data_bag_cache "users" do
search "group:sysadmin"
end
Get all items in the users data bag where the shell is /bin/zsh:
ruby
data_bag_cache "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 "users" do
cache_disabled true
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.
Collaborator Number Metric
0.2.0 failed this metric
Failure: Cookbook has 0 collaborators. A cookbook must have at least 2 collaborators to pass this metric.
Contributing File Metric
0.2.0 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a CONTRIBUTING.md file
Foodcritic Metric
0.2.0 failed this metric
FC039: Node method cannot be accessed with key: data-bag-cache/definitions/data_bag_cache.rb:55
FC064: Ensure issues_url is set in metadata: data-bag-cache/metadata.rb:1
FC065: Ensure source_url is set in metadata: data-bag-cache/metadata.rb:1
FC066: Ensure chef_version is set in metadata: data-bag-cache/metadata.rb:1
FC067: Ensure at least one platform supported in metadata: data-bag-cache/metadata.rb:1
Run with Foodcritic Version 16.3.0 with tags metadata,correctness ~FC031 ~FC045 and failure tags any
No Binaries Metric
0.2.0 passed this metric
Testing File Metric
0.2.0 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a TESTING.md file
Version Tag Metric
0.2.0 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number
0.2.0 failed this metric
0.2.0 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a CONTRIBUTING.md file
Foodcritic Metric
0.2.0 failed this metric
FC039: Node method cannot be accessed with key: data-bag-cache/definitions/data_bag_cache.rb:55
FC064: Ensure issues_url is set in metadata: data-bag-cache/metadata.rb:1
FC065: Ensure source_url is set in metadata: data-bag-cache/metadata.rb:1
FC066: Ensure chef_version is set in metadata: data-bag-cache/metadata.rb:1
FC067: Ensure at least one platform supported in metadata: data-bag-cache/metadata.rb:1
Run with Foodcritic Version 16.3.0 with tags metadata,correctness ~FC031 ~FC045 and failure tags any
No Binaries Metric
0.2.0 passed this metric
Testing File Metric
0.2.0 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a TESTING.md file
Version Tag Metric
0.2.0 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number
0.2.0 failed this metric
FC064: Ensure issues_url is set in metadata: data-bag-cache/metadata.rb:1
FC065: Ensure source_url is set in metadata: data-bag-cache/metadata.rb:1
FC066: Ensure chef_version is set in metadata: data-bag-cache/metadata.rb:1
FC067: Ensure at least one platform supported in metadata: data-bag-cache/metadata.rb:1
Run with Foodcritic Version 16.3.0 with tags metadata,correctness ~FC031 ~FC045 and failure tags any
0.2.0 passed this metric
Testing File Metric
0.2.0 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a TESTING.md file
Version Tag Metric
0.2.0 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number
0.2.0 failed this metric
0.2.0 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number