Sha256: 9bcdc826165c5175f86dc2a28f8a01b8528f9793173fb6307c873b72269e651c

Contents?: true

Size: 1.08 KB

Versions: 4

Compression:

Stored size: 1.08 KB

Contents

class TestLab

  class Provisioner

    # Shell Provisioner Error Class
    class ShellError < ProvisionerError; end

    # Shell Provisioner Class
    #
    # @author Zachary Patten <zachary AT jovelabs DOT com>
    class Shell
      require 'tempfile'

      def initialize(config={}, ui=nil)
        @config = (config || Hash.new)
        @ui     = (ui || TestLab.ui)
      end

      # Shell Provisioner Container Setup
      #
      # Renders the defined script to a temporary file on the target container
      # and proceeds to execute said script as root via *lxc-attach*.
      #
      # @param [TestLab::Container] container The container which we want to
      #   provision.
      # @return [Boolean] True if successful.
      def setup(container)
        if !@config[:script].nil?
          container.bootstrap(@config[:script])
        end

        true
      end

      # Shell Provisioner Container Teardown
      #
      # This is a NO-OP currently.
      #
      # @return [Boolean] True if successful.
      def teardown(container)
        # NOOP

        true
      end

    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
testlab-0.5.4 lib/testlab/provisioners/shell.rb
testlab-0.5.3 lib/testlab/provisioners/shell.rb
testlab-0.5.2 lib/testlab/provisioners/shell.rb
testlab-0.5.1 lib/testlab/provisioners/shell.rb