Class: ChefMetal::ActionHandler
- Inherits:
-
Object
- Object
- ChefMetal::ActionHandler
- Defined in:
- lib/chef_metal/action_handler.rb
Direct Known Subclasses
Instance Method Summary collapse
-
#host_node ⇒ Object
A URL identifying the host node.
-
#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
- #report_progress(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
#host_node ⇒ Object
A URL identifying the host node. nil if no such node.
60 61 |
# File 'lib/chef_metal/action_handler.rb', line 60 def host_node end |
#open_stream(name) ⇒ Object
Open a stream which can be printed to and closed
51 52 53 54 55 56 57 |
# File 'lib/chef_metal/action_handler.rb', line 51 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.
43 44 45 46 47 48 |
# File 'lib/chef_metal/action_handler.rb', line 43 def perform_action(description) if should_perform_actions yield end performed_action(description) end |
#performed_action(description) ⇒ Object
37 38 39 |
# File 'lib/chef_metal/action_handler.rb', line 37 def performed_action(description) Array(description).each { |d| puts d } end |
#report_progress(description) ⇒ Object
33 34 35 |
# File 'lib/chef_metal/action_handler.rb', line 33 def report_progress(description) Array(description).each { |d| puts d } 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 |