Sha256: f763faa51ae986542ee14f4d4026b5c7b45da28d8c637fe91e633b4ed23439a2

Contents?: true

Size: 1.36 KB

Versions: 20

Compression:

Stored size: 1.36 KB

Contents

class TestLab
  class Container

    module Lifecycle

      # Setup the container
      #
      # Attempts to setup the container.  We first create the container, then
      # attempt to bring it online.  Afterwards the containers provisioner is
      # called.
      #
      # @return [Boolean] True if successful.
      def setup
        @ui.logger.debug { "Container Setup: #{self.id} " }

        self.create
        self.up

        if (!@provisioner.nil? && @provisioner.respond_to?(:setup))
          please_wait(:ui => @ui, :message => format_object_action(self, 'Setup', :green)) do
            @provisioner.setup(self)
          end
        end

        true
      end

      # Teardown the container
      #
      # Attempts to teardown the container.  We first call the provisioner
      # teardown method defined for the container, if any.  Next we attempt to
      # offline the container.  Afterwards the container is destroy.
      #
      # @return [Boolean] True if successful.
      def teardown
        @ui.logger.debug { "Container Teardown: #{self.id} " }

        if (!@provisioner.nil? && @provisioner.respond_to?(:teardown))
          please_wait(:ui => @ui, :message => format_object_action(self, 'Teardown', :red)) do
            @provisioner.teardown(self)
          end
        end

        self.down
        self.destroy

        true
      end

    end

  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
testlab-0.5.0 lib/testlab/container/lifecycle.rb
testlab-0.4.16 lib/testlab/container/lifecycle.rb
testlab-0.4.15 lib/testlab/container/lifecycle.rb
testlab-0.4.14 lib/testlab/container/lifecycle.rb
testlab-0.4.13 lib/testlab/container/lifecycle.rb
testlab-0.4.12 lib/testlab/container/lifecycle.rb
testlab-0.4.11 lib/testlab/container/lifecycle.rb
testlab-0.4.10 lib/testlab/container/lifecycle.rb
testlab-0.4.9 lib/testlab/container/lifecycle.rb
testlab-0.4.8 lib/testlab/container/lifecycle.rb
testlab-0.4.7 lib/testlab/container/lifecycle.rb
testlab-0.4.6 lib/testlab/container/lifecycle.rb
testlab-0.4.5 lib/testlab/container/lifecycle.rb
testlab-0.4.4 lib/testlab/container/lifecycle.rb
testlab-0.4.3 lib/testlab/container/lifecycle.rb
testlab-0.4.2 lib/testlab/container/lifecycle.rb
testlab-0.4.1 lib/testlab/container/lifecycle.rb
testlab-0.4.0 lib/testlab/container/lifecycle.rb
testlab-0.3.1 lib/testlab/container/lifecycle.rb
testlab-0.3.0 lib/testlab/container/lifecycle.rb