lib/testlab/node/lifecycle.rb in testlab-0.1.0 vs lib/testlab/node/lifecycle.rb in testlab-0.2.0
- old
+ new
@@ -12,10 +12,12 @@
end
# Calls the specified method on all the objects supplied
def call_methods(objects, method_name)
objects.each do |object|
+ # @ui.stdout.puts(format_message(format_object(object, (method_name == :setup ? :green : :red))))
+
if object.respond_to?(method_name)
object.send(method_name)
end
end
end
@@ -28,18 +30,22 @@
# Setup the node.
def setup
@ui.logger.debug { "Node Setup: #{self.id} " }
- node_setup
+ # @ui.stdout.puts(format_message(format_object(self, :green)))
- if self.components.include?('resolv')
- build_resolv_conf
- end
+ please_wait(:ui => @ui, :message => format_object_action(self, 'Setup', :green)) do
+ node_setup
- if self.components.include?('bind')
- bind_setup
+ if self.components.include?('resolv')
+ build_resolv_conf
+ end
+
+ if self.components.include?('bind')
+ bind_setup
+ end
end
call_collections([self.networks, self.routers, self.containers], :setup)
if self.components.include?('bind')
@@ -51,10 +57,15 @@
# Teardown the node.
def teardown
@ui.logger.debug { "Node Teardown: #{self.id} " }
+ # @ui.stdout.puts(format_message(format_object(self, :red)))
+
call_collections([self.containers, self.routers, self.networks], :teardown)
+
+ please_wait(:ui => @ui, :message => format_object_action(self, 'Teardown', :red)) do
+ end
true
end
end