Module: Kitchen::Provisioner

Defined in:
lib/kitchen/provisioner.rb,
lib/kitchen/provisioner/base.rb,
lib/kitchen/provisioner/dummy.rb,
lib/kitchen/provisioner/shell.rb,
lib/kitchen/provisioner/chef_base.rb,
lib/kitchen/provisioner/chef_solo.rb,
lib/kitchen/provisioner/chef_zero.rb,
lib/kitchen/provisioner/chef/berkshelf.rb,
lib/kitchen/provisioner/chef/librarian.rb,
lib/kitchen/provisioner/chef/common_sandbox.rb

Overview

A provisioner is responsible for generating the commands necessary to install set up and use a configuration management tool such as Chef and Puppet.

Author:

Defined Under Namespace

Modules: Chef Classes: Base, ChefBase, ChefSolo, ChefZero, Dummy, Shell

Constant Summary collapse

DEFAULT_PLUGIN =

Default provisioner to use

"chef_solo".freeze

Class Method Summary collapse

Class Method Details

.for_plugin(plugin, config) ⇒ Provisioner::Base

Returns an instance of a provisioner given a plugin type string.

Parameters:

  • plugin (String)

    a provisioner plugin type, to be constantized

  • config (Hash)

    a configuration hash to initialize the provisioner

Returns:

Raises:

  • (ClientError)

    if a provisioner instance could not be created



39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/kitchen/provisioner.rb', line 39

def self.for_plugin(plugin, config)
  first_load = require("kitchen/provisioner/#{plugin}")

  str_const = Thor::Util.camel_case(plugin)
  klass = const_get(str_const)
  object = klass.new(config)
  object.verify_dependencies if first_load
  object
rescue LoadError, NameError
  raise ClientError,
    "Could not load the '#{plugin}' provisioner from the load path." \
      " Please ensure that your provisioner is installed as a gem or" \
      " included in your Gemfile if using Bundler."
end