Module: ChefMetal::ProviderActionHandler

Included in:
Chef::Provider::Machine, Chef::Provider::MachineBatch, Chef::Provider::MachineExecute, Chef::Provider::MachineFile
Defined in:
lib/chef_metal/provider_action_handler.rb

Instance Method Summary collapse

Instance Method Details

#debug_nameObject



43
44
45
# File 'lib/chef_metal/provider_action_handler.rb', line 43

def debug_name
  self.cookbook_name
end

#open_stream(name, &block) ⇒ Object



47
48
49
50
51
52
53
54
55
56
57
# File 'lib/chef_metal/provider_action_handler.rb', line 47

def open_stream(name, &block)
  if self.run_context.respond_to?(:open_stream)
    self.run_context.open_stream({ :name => name }, &block)
  else
    if block_given?
      yield STDOUT
    else
      STDOUT
    end
  end
end

#perform_action(description, &block) ⇒ Object



39
40
41
# File 'lib/chef_metal/provider_action_handler.rb', line 39

def perform_action(description, &block)
  self.converge_by(description, &block)
end

#performed_action(description) ⇒ Object



33
34
35
36
37
# File 'lib/chef_metal/provider_action_handler.rb', line 33

def performed_action(description)
  self.converge_by description do
    # We already did the action, but we trust whoever told us that they did it.
  end
end

#should_perform_actionsObject



29
30
31
# File 'lib/chef_metal/provider_action_handler.rb', line 29

def should_perform_actions
  !Chef::Config.why_run
end

#updated!Object

Implementation of ActionHandler interface



25
26
27
# File 'lib/chef_metal/provider_action_handler.rb', line 25

def updated!
  self.new_resource.updated_by_last_action(true)
end