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

RSS

bag_config (4) Versions 2.0.1

Provides helpers for optional data bag configuration

Berkshelf/Librarian
Policyfile
Knife
cookbook 'bag_config', '~> 2.0.1'
cookbook 'bag_config', '~> 2.0.1', :supermarket
knife cookbook site install bag_config
knife cookbook site download bag_config
README
Dependencies
Quality 33%

BagConfig

Making data bag entries the "last mile" of attribute overrides.

What's it do?

This cookbook allows attributes to be provided via data bag entries. It slips functionality into recipes seamlessly to provide consistent functionality across all recipes, not just those explicitly built for it.

Repository

https://github.com/heavywater/chef-bag_config

Basic Usage

Access attributes the same way as always:

  • node[:my_cookbook][:my_attribute]

Naming scheme

Data bags

The name of the data bag used will correspond to the name of the base attribute key used within a cookbook. For example, the base attribute key for the munin cookbook is munin thus the data bag name used will be munin. However, the chef-client cookbook uses the base attribute key of chef_client so the data bag name it uses will be chef_client.

The naming of the data bag entries are based on the node name with a config_ prefix. Given a node named lucid, the data bag entry id would be config_lucid. Periods are replaced with underscores within the node name for generating the data bag entry name. Thus, a node named lucid.example.com would have a data bag entry id of config_lucid_example_com.

Quick Ref:

cookbook: chef-client
base key: chef_client
node name: test1.box
data bag name: chef_client
data bag entry id: config_test1_box

Advanced Usage

Custom Data Bag

Example: Use the myconfig data bag to supply configuration entries for the nagios attribute:

  • node[:bag_config][:nagios] = {:bag => :myconfig}

Custom Data Bag Entry

Example: Use custom_config data bag entry id under the nagios base attribute key:

  • node[:bag_config][:nagios] = {:item => 'custom_config'}

Encrypted Data Bag Entry

Encrypted data bags are supported when the encrypted attribute is set:

  • `node[:bag_config][:nagios] = {:encrypted => true}

This will require the secret being provided either inline:

  • node[:bag_config][:nagios] = {:secret => 'my_secret'}

or as a path to the secret file on the node:

  • node[:bag_config][:nagios] = {:secret => '/etc/config_secret.file'}

Allowing/Restricting lookups

By default, the every base attribute key used will invoke an attempt to load a configuration data bag item related to that key. To help reduce the number of lookups required on a run, whitelisting and blacklisting on keys is available:

  • node[:bag_config][:bag_whitelist] = [:nagios, :djbdns]
  • node[:bag_config][:bag_blacklist] = [:nginx, :apache]

NOTE: The blacklist will always have precedence. This means that if an item has been specified in the whitelist and is also found in the blacklist, it will be blacklisted.

Compatibility Note

This version is incompatible with the 1.x versions. It removes all custom methods from Recipe instances and instead proxies the attribute requests via the node, so no modifications are required for full support.

Dependent cookbooks

This cookbook has no specified dependencies.

Contingent cookbooks

gem_installer Applicable Versions

Collaborator Number Metric
            

2.0.1 failed this metric

Failure: Cookbook has 0 collaborators. A cookbook must have at least 2 collaborators to pass this metric.

Contributing File Metric
            

2.0.1 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
            

2.0.1 failed this metric

FC064: Ensure issues_url is set in metadata: bag_config/metadata.rb:1
FC065: Ensure source_url is set in metadata: bag_config/metadata.rb:1
FC066: Ensure chef_version is set in metadata: bag_config/metadata.rb:1
FC067: Ensure at least one platform supported in metadata: bag_config/metadata.rb:1
FC069: Ensure standardized license defined in metadata: bag_config/metadata.rb:1
Run with Foodcritic Version 12.0.1 with tags metadata,correctness ~FC031 ~FC045 and failure tags any

License Metric
            

2.0.1 passed this metric

No Binaries Metric
            

2.0.1 passed this metric

Publish Metric
            

2.0.1 passed this metric

Supported Platforms Metric
            

2.0.1 failed this metric

bag_config should declare what platform(s) it supports.

Testing File Metric
            

2.0.1 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
            

2.0.1 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