Sha256: a838578b2e9548838df7e690453d6f8675c200caf055e859cea046730afa6d8e

Contents?: true

Size: 958 Bytes

Versions: 69

Compression:

Stored size: 958 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: Container Provision
      #
      # 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_provision(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

69 entries across 69 versions & 1 rubygems

Version Path
testlab-1.8.2 lib/testlab/provisioners/shell.rb
testlab-1.8.1 lib/testlab/provisioners/shell.rb
testlab-1.8.0 lib/testlab/provisioners/shell.rb
testlab-1.7.1 lib/testlab/provisioners/shell.rb
testlab-1.7.0 lib/testlab/provisioners/shell.rb
testlab-1.6.6 lib/testlab/provisioners/shell.rb
testlab-1.6.5 lib/testlab/provisioners/shell.rb
testlab-1.6.4 lib/testlab/provisioners/shell.rb
testlab-1.6.3 lib/testlab/provisioners/shell.rb
testlab-1.6.2 lib/testlab/provisioners/shell.rb
testlab-1.6.1 lib/testlab/provisioners/shell.rb
testlab-1.6.0 lib/testlab/provisioners/shell.rb
testlab-1.5.1 lib/testlab/provisioners/shell.rb
testlab-1.5.0 lib/testlab/provisioners/shell.rb
testlab-1.4.4 lib/testlab/provisioners/shell.rb
testlab-1.4.3 lib/testlab/provisioners/shell.rb
testlab-1.4.2 lib/testlab/provisioners/shell.rb
testlab-1.4.1 lib/testlab/provisioners/shell.rb
testlab-1.4.0 lib/testlab/provisioners/shell.rb
testlab-1.3.2 lib/testlab/provisioners/shell.rb