cookbook 'poise-hoist', '~> 1.2.1'
poise-hoist (4) Versions 1.2.1 Follow1
Automatically hoist environment level-attributes from Policyfiles.
cookbook 'poise-hoist', '~> 1.2.1', :supermarket
knife supermarket install poise-hoist
knife supermarket download poise-hoist
Poise-Hoist
A cookbook to help automate "attribute hoisting" when using Chef with Policyfiles.
Attribute hoisting is a way to store per-policy-group attributes in a policy to
allow similar settings to environment-level attributes in a pre-Policyfile
workflow. Just put the desired attributes under a top-level key matching the
name of the policy group and add poise-hoist
either to your run list or to
your cookbook dependencies.
Quick Start
In your Policyfile:
name 'myapp' run_list 'poise-hoist', 'myapp' # Default value for all groups. default['myapp']['debug_mode'] = true # Per-group values, will be hoisted on top of the default above. default['staging']['myapp']['debug_mode'] = 'extra_verbose' default['prod']['myapp']['debug_mode'] = false
and then in your recipe code:
some_resource 'name' do debug_mode node['myapp']['debug_mode'] end
This automatically hoists up policy attributes set under a top-level key
matching the name of the policy group of the current node.
Requirements
Chef 12.2 or newer is required.
Use With Test Kitchen
When testing policies with the policyfile_zero
provisioner plugin, the policy
group will always be local
.
default['local']['myapp']['debug_mode'] = true
Environment Shim
For older cookbooks still expecting to use node.chef_environment
, by default
that method will be patched to return the policy group label instead. This can
be disabled by setting node['poise-hoist']['hoist_chef_environment'] = false
.
Data Bag Attributes
To pull in data from a data bag, set default['poise-hoist']['data_bag'] = 'the name of the data bag'
in your Policyfile. It will look for an item in the specified data bag using the
name of the node and then the name of policy group. You can use this in
combination with the normal group-level hoisting to have a different data bag
name for some policy groups.
This can be useful in combination with attributes from the Policyfile to provide
immediate overrides outside of the "compile and push" cycle of the policy system.
Sponsors
Development sponsored by Bloomberg.
The Poise test server infrastructure is generously sponsored by Rackspace. Thanks Rackspace!
License
Copyright 2016-2017, Noah Kantrowitz
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Dependent cookbooks
This cookbook has no specified dependencies.
Contingent cookbooks
There are no cookbooks that are contingent upon this one.
Poise-Hoist Changelog
v1.2.1
- Fix a logic error if you aren't using the data bag support.
v1.2.0
- Support for reading attributes from data bags when configured via
node['poise-hoist']['data_bag']
.
v1.1.0
- Add
node.chef_environment
shim for older cookbooks.
v1.0.0
- Initial release!
Collaborator Number Metric
1.2.1 failed this metric
Failure: Cookbook has 0 collaborators. A cookbook must have at least 2 collaborators to pass this metric.
Contributing File Metric
1.2.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
1.2.1 passed this metric
No Binaries Metric
1.2.1 passed this metric
Testing File Metric
1.2.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
1.2.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
1.2.1 failed this metric
1.2.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
1.2.1 passed this metric
No Binaries Metric
1.2.1 passed this metric
Testing File Metric
1.2.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
1.2.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
1.2.1 passed this metric
1.2.1 passed this metric
Testing File Metric
1.2.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
1.2.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
1.2.1 failed this metric
1.2.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