lib/testlab/container/actions.rb in testlab-0.6.4 vs lib/testlab/container/actions.rb in testlab-0.6.5

- old
+ new

@@ -10,10 +10,12 @@ # # @return [Boolean] True if successful. def create @ui.logger.debug { "Container Create: #{self.id} " } + (self.lxc.state != :not_created) and return false + please_wait(:ui => @ui, :message => format_object_action(self, 'Create', :green)) do self.domain ||= self.node.labfile.config[:domain] self.arch ||= detect_arch build_lxc_config(self.lxc.config) @@ -46,11 +48,11 @@ # # @return [Boolean] True if successful. def up @ui.logger.debug { "Container Up: #{self.id} " } - (self.lxc.state == :not_created) and return false #raise ContainerError, "We can not online a non-existant container!" + (self.lxc.state == :running) and return false please_wait(:ui => @ui, :message => format_object_action(self, 'Up', :green)) do # ensure our container is in "static" mode self.to_static @@ -75,10 +77,10 @@ # # @return [Boolean] True if successful. def down @ui.logger.debug { "Container Down: #{self.id} " } - (self.lxc.state == :not_created) and return false # raise ContainerError, "We can not offline a non-existant container!" + (self.lxc.state == :not_created) and return false please_wait(:ui => @ui, :message => format_object_action(self, 'Down', :red)) do self.lxc.stop self.lxc.wait(:stopped)