Class: ChefMetal::ActionHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/chef_metal/action_handler.rb

Instance Method Summary collapse

Instance Method Details

#debug_nameObject

This is the name that will show up in the output, so should be something like a cookbook or driver name

Raises:

  • (ActionFailed)


45
46
47
# File 'lib/chef_metal/action_handler.rb', line 45

def debug_name
  raise ActionFailed, "ActionHandler behavior requires a debug_name"
end

#perform_action(description, &block) ⇒ Object

This should perform the actual action (e.g., converge) if there is an action that needs to be done.

By default, it will simply execute the block as so:



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

def perform_action(description, &block)
  puts description
  block.call
end

#recipe_contextObject

This should be the run context

Raises:

  • (ActionFailed)


24
25
26
# File 'lib/chef_metal/action_handler.rb', line 24

def recipe_context
  raise ActionFailed, "ActionHandler behavior requires a recipe_context"
end

#updated!Object

This should be repaced with whatever records the update; by default it essentially does nothing here.



30
31
32
# File 'lib/chef_metal/action_handler.rb', line 30

def updated!
  @updated = true
end