Parent

Files

Class/Module Index [+]

Quicksearch

Chef::Mixin::WhyRun::ConvergeActions

ConvergeActions

ConvergeActions implements the logic for why run. A ConvergeActions object wraps a collection of actions, which consist of a descriptive string and a block/Proc. Actions are executed by calling converge! When why_run mode is enabled, each action's description will be printed, but the block will not be called. Conversely, in normal mode, the block is called, but the message is not printed.

In general, this class should be accessed through the API provided by Chef::Provider.

Attributes

actions[R]

Public Class Methods

new(resource, run_context, action) click to toggle source
# File lib/chef/mixin/why_run.rb, line 37
def initialize(resource, run_context, action)
  @resource, @run_context = resource, run_context
  @actions = []
end

Public Instance Methods

add_action(descriptions, &block) click to toggle source

Adds an action to the list. descriptions can either be an Array of Strings, or a single String describing the action; block is a block/proc that implements the action.

# File lib/chef/mixin/why_run.rb, line 49
def add_action(descriptions, &block)
  @actions << [descriptions, block]
  if !Chef::Config[:why_run]
    block.call
  end
  events.resource_update_applied(@resource, @action, descriptions)
end
empty?() click to toggle source

True if there are no actions to execute.

# File lib/chef/mixin/why_run.rb, line 58
def empty?
  @actions.empty?
end
events() click to toggle source
# File lib/chef/mixin/why_run.rb, line 42
def events
  @run_context.events
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.