Sha256: 8825b733a8c754762674a5129401573483fe727be63bec75dccec6b698191199

Contents?: true

Size: 1.38 KB

Versions: 30

Compression:

Stored size: 1.38 KB

Contents

class TestLab
  class Network

    module Actions

      # Create the network
      def create
        @ui.logger.debug { "Network Create: #{self.id} " }

        please_wait(:ui => @ui, :message => format_object_action(self, 'Create', :green)) do
          self.node.ssh.exec(%(sudo brctl addbr #{self.bridge}), :silence => true, :ignore_exit_status => true)
        end
      end

      # Destroy the network
      def destroy
        @ui.logger.debug { "Network Destroy: #{self.id} " }

        please_wait(:ui => @ui, :message => format_object_action(self, 'Destroy', :red)) do
          self.node.ssh.exec(%(sudo brctl delbr #{self.bridge}), :silence => true, :ignore_exit_status => true)
        end
      end

      # Start the network
      def up
        @ui.logger.debug { "Network Up: #{self.id} " }

        please_wait(:ui => @ui, :message => format_object_action(self, 'Up', :green)) do
          self.node.ssh.exec(%(sudo ifconfig #{self.bridge} #{self.ip} netmask #{self.netmask} up), :silence => true, :ignore_exit_status => true)
        end
      end

      # Stop the network
      def down
        @ui.logger.debug { "Network Down: #{self.id} " }

        please_wait(:ui => @ui, :message => format_object_action(self, 'Down', :red)) do
          self.node.ssh.exec(%(sudo ifconfig #{self.bridge} down), :silence => true, :ignore_exit_status => true)
        end
      end

    end

  end
end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
testlab-0.6.5 lib/testlab/network/actions.rb
testlab-0.6.4 lib/testlab/network/actions.rb
testlab-0.6.3 lib/testlab/network/actions.rb
testlab-0.6.2 lib/testlab/network/actions.rb
testlab-0.6.1 lib/testlab/network/actions.rb
testlab-0.6.0 lib/testlab/network/actions.rb
testlab-0.5.4 lib/testlab/network/actions.rb
testlab-0.5.3 lib/testlab/network/actions.rb
testlab-0.5.2 lib/testlab/network/actions.rb
testlab-0.5.1 lib/testlab/network/actions.rb
testlab-0.5.0 lib/testlab/network/actions.rb
testlab-0.4.16 lib/testlab/network/actions.rb
testlab-0.4.15 lib/testlab/network/actions.rb
testlab-0.4.14 lib/testlab/network/actions.rb
testlab-0.4.13 lib/testlab/network/actions.rb
testlab-0.4.12 lib/testlab/network/actions.rb
testlab-0.4.11 lib/testlab/network/actions.rb
testlab-0.4.10 lib/testlab/network/actions.rb
testlab-0.4.9 lib/testlab/network/actions.rb
testlab-0.4.8 lib/testlab/network/actions.rb