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#failure_message

Defines the failure message, and optionally the Exception class to
use when a requirement is not met. It works like `raise`:
  # in a provider:
  assert(:some_action) do |a|
    # This example shows usage with 1 or 2 args by calling #failure_message twice.
    # In practice you should only call this once per Assertion.

    # Set the Exception class explicitly
    a.failure_message(Chef::Exceptions::MissingRequiredFile, "File /tmp/foo doesn't exist")
    # Fallback to the default error class (AssertionFailure)
    a.failure_message("File /tmp/foo" doesn't exist")
  end

Source | Google | Stack overflow

Edit

git clone [email protected]:opscode/chef.git

cd chef

open lib/chef/mixin/why_run.rb

Contribute

# Make a new branch

git checkout -b -your-name--update-docs-Chef--Mixin--WhyRun--ResourceRequirements--Assertion-failure_message-for-pr


# Commit to git

git add lib/chef/mixin/why_run.rbgit commit -m "better docs for Chef::Mixin::WhyRun::ResourceRequirements::Assertion#failure_message"


# Open pull request

gem 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-failure_message-for-pr

hub pull-request


# Celebrate!