Class: TestLab::Provisioner::Shell

Inherits:
Object
  • Object
show all
Defined in:
lib/testlab/provisioners/shell.rb

Overview

Shell Provisioner Class

Author:

  • Zachary Patten <zachary AT jovelabs DOT com>

Instance Method Summary collapse

Constructor Details

#initialize(config = {}, ui = nil) ⇒ Shell

Returns a new instance of Shell.



14
15
16
17
# File 'lib/testlab/provisioners/shell.rb', line 14

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

Instance Method Details

#on_container_provision(container) ⇒ Boolean

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.

Parameters:

Returns:

  • (Boolean)

    True if successful.



27
28
29
30
31
32
33
# File 'lib/testlab/provisioners/shell.rb', line 27

def on_container_provision(container)
  @config[:script].nil? and raise ShellError, "You must supply a script to bootstrap!"

  container.bootstrap(@config[:script])

  true
end