chef
https://github.com/opscode/chef
Ruby
A systems integration framework, built to bring the benefits of configuration management to your entire infrastructure.
Chef::Mixin::WhyRun::ResourceRequirements::Assertion#whyrun
Defines a message and optionally provides a code block to execute
when the requirement is not met and Chef is executing in why run
mode
If no failure_message is provided (above), then execution
will be allowed to continue in both whyrun and non-whyrun
mode
With a service resource that requires /etc/init.d/service-name to exist:
# in a provider
assert(:start, :restart) do |a|
a.assertion { ::File.exist?("/etc/init.d/service-name") }
a.whyrun("Init script '/etc/init.d/service-name' doesn't exist, assuming a prior action would have created it.") do
# blindly assume that the service exists but is stopped in why run mode:
@new_resource.status(:stopped)
end
endEdit
git clone [email protected]:opscode/chef.git
cd chef
open lib/chef/mixin/why_run.rb
Contribute
# Make a new branchgit checkout -b -your-name--update-docs-Chef--Mixin--WhyRun--ResourceRequirements--Assertion-whyrun-for-pr
# Commit to gitgit add lib/chef/mixin/why_run.rbgit commit -m "better docs for Chef::Mixin::WhyRun::ResourceRequirements::Assertion#whyrun"
# Open pull requestgem install hub # on a mac you can `brew install hub`
hub fork
git push <your name> -your-name--update-docs-Chef--Mixin--WhyRun--ResourceRequirements--Assertion-whyrun-for-pr
hub pull-request
# Celebrate!