Class: ChefMetal::ActionHandler
- Inherits:
-
Object
- Object
- ChefMetal::ActionHandler
- Defined in:
- lib/chef_metal/action_handler.rb
Instance Method Summary collapse
-
#debug_name ⇒ Object
This is the name that will show up in the output, so should be something like a cookbook or driver name.
-
#open_stream(name) ⇒ Object
Open a stream which can be printed to and closed.
-
#perform_action(description) ⇒ Object
This should perform the actual action (e.g., converge) if there is an action that needs to be done.
- #performed_action(description) ⇒ Object
- #should_perform_actions ⇒ Object
-
#updated! ⇒ Object
This should be replaced with whatever records the update; by default it essentially does nothing here.
Instance Method Details
#debug_name ⇒ Object
This is the name that will show up in the output, so should be something like a cookbook or driver name
48 49 50 |
# File 'lib/chef_metal/action_handler.rb', line 48 def debug_name raise ActionFailed, "ActionHandler behavior requires a debug_name" end |
#open_stream(name) ⇒ Object
Open a stream which can be printed to and closed
53 54 55 56 57 58 59 |
# File 'lib/chef_metal/action_handler.rb', line 53 def open_stream(name) if block_given? yield STDOUT else STDOUT end end |
#perform_action(description) ⇒ Object
This should perform the actual action (e.g., converge) if there is an action that needs to be done.
39 40 41 42 43 44 |
# File 'lib/chef_metal/action_handler.rb', line 39 def perform_action(description) if should_perform_actions yield end performed_action(description) end |
#performed_action(description) ⇒ Object
33 34 35 |
# File 'lib/chef_metal/action_handler.rb', line 33 def performed_action(description) puts description end |
#should_perform_actions ⇒ Object
29 30 31 |
# File 'lib/chef_metal/action_handler.rb', line 29 def should_perform_actions true end |
#updated! ⇒ Object
This should be replaced with whatever records the update; by default it essentially does nothing here.
25 26 27 |
# File 'lib/chef_metal/action_handler.rb', line 25 def updated! @updated = true end |