Sha256: d8485e30d38fb003874d9346d50308f6bf838601b7b43eac21fa8f5b1babbd62

Contents?: true

Size: 961 Bytes

Versions: 17

Compression:

Stored size: 961 Bytes

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)
        @ui     = (ui     || TestLab.ui)
        @config = (config || Hash.new)
      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 on_container_setup(container)
        @config[:script].nil? and raise ShellError, "You must supply a script to bootstrap!"

        container.bootstrap(@config[:script])

        true
      end

    end

  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
testlab-0.9.1 lib/testlab/provisioners/shell.rb
testlab-0.9.0 lib/testlab/provisioners/shell.rb
testlab-0.8.6 lib/testlab/provisioners/shell.rb
testlab-0.8.5 lib/testlab/provisioners/shell.rb
testlab-0.8.4 lib/testlab/provisioners/shell.rb
testlab-0.8.3 lib/testlab/provisioners/shell.rb
testlab-0.8.2 lib/testlab/provisioners/shell.rb
testlab-0.8.1 lib/testlab/provisioners/shell.rb
testlab-0.8.0 lib/testlab/provisioners/shell.rb
testlab-0.7.6 lib/testlab/provisioners/shell.rb
testlab-0.7.5 lib/testlab/provisioners/shell.rb
testlab-0.7.4 lib/testlab/provisioners/shell.rb
testlab-0.7.3 lib/testlab/provisioners/shell.rb
testlab-0.7.2 lib/testlab/provisioners/shell.rb
testlab-0.7.1 lib/testlab/provisioners/shell.rb
testlab-0.7.0 lib/testlab/provisioners/shell.rb
testlab-0.6.17 lib/testlab/provisioners/shell.rb