Class: Rundock::Node
Instance Attribute Summary collapse
-
#backend ⇒ Object
readonly
Returns the value of attribute backend.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#operations ⇒ Object
readonly
Returns the value of attribute operations.
Instance Method Summary collapse
- #add_operation(ope) ⇒ Object
- #complete(scenario) ⇒ Object
-
#initialize(name, backend) ⇒ Node
constructor
A new instance of Node.
- #run ⇒ Object
Constructor Details
#initialize(name, backend) ⇒ Node
Returns a new instance of Node.
9 10 11 12 13 |
# File 'lib/rundock/node.rb', line 9 def initialize(name, backend) @name = name @backend = backend @operations = [] end |
Instance Attribute Details
#backend ⇒ Object (readonly)
Returns the value of attribute backend.
7 8 9 |
# File 'lib/rundock/node.rb', line 7 def backend @backend end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/rundock/node.rb', line 5 def name @name end |
#operations ⇒ Object (readonly)
Returns the value of attribute operations.
6 7 8 |
# File 'lib/rundock/node.rb', line 6 def operations @operations end |
Instance Method Details
#add_operation(ope) ⇒ Object
15 16 17 18 |
# File 'lib/rundock/node.rb', line 15 def add_operation(ope) @operations = [] unless @operations @operations << ope end |
#complete(scenario) ⇒ Object
20 21 22 23 24 |
# File 'lib/rundock/node.rb', line 20 def complete(scenario) @operations.each do |ope| ope.attributes[:nodeinfo].merge!(scenario.node_info) end end |
#run ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/rundock/node.rb', line 26 def run Logger.debug("run node: #{@name}") if @operations.blank? Logger.warn("no operation running: #{@name}") return end @operations.each do |ope| Logger.debug("run operation: #{ope.class}") ope.run(@backend, ope.attributes) end end |