lib/testlab/network/actions.rb in testlab-1.4.4 vs lib/testlab/network/actions.rb in testlab-1.5.0

- old
+ new

@@ -5,12 +5,11 @@ # Create the network def create @ui.logger.debug { "Network Create: #{self.id} " } - (self.node.state == :running) or return false - (self.state == :not_created) or return false + self.node.alive? or return false please_wait(:ui => @ui, :message => format_object_action(self, 'Create', :green)) do self.node.bootstrap(<<-EOF, :ignore_exit_status => true) set -x grep '#{def_tag}' /etc/network/interfaces && exit 0 @@ -39,12 +38,11 @@ # Destroy the network def destroy @ui.logger.debug { "Network Destroy: #{self.id} " } - (self.node.state == :running) or return false - (self.state != :not_created) or return false + self.node.alive? or return false please_wait(:ui => @ui, :message => format_object_action(self, 'Destroy', :red)) do self.node.bootstrap(<<-EOF, :ignore_exit_status => true) set -x sed -i '/#{def_tag}/,/#{end_tag}/d' /etc/network/interfaces @@ -59,12 +57,11 @@ # Start the network def up @ui.logger.debug { "Network Up: #{self.id} " } - (self.node.state == :running) or return false - # (self.state != :running) or return false + self.node.alive? or return false please_wait(:ui => @ui, :message => format_object_action(self, 'Up', :green)) do self.node.bootstrap(<<-EOF, :ignore_exit_status => true) set -x ifconfig #{self.bridge} #{self.ip} netmask #{self.netmask} broadcast #{self.broadcast} up @@ -78,11 +75,10 @@ # Stop the network def down @ui.logger.debug { "Network Down: #{self.id} " } - (self.node.state == :running) or return false - # (self.state == :running) or return false + self.node.alive? or return false please_wait(:ui => @ui, :message => format_object_action(self, 'Down', :red)) do self.node.bootstrap(<<-EOF, :ignore_exit_status => true) set -x ifconfig #{self.bridge} down