Class: Kitchen::Provisioner::ChefSolo

Inherits:
ChefBase show all
Defined in:
lib/kitchen/provisioner/chef_solo.rb

Overview

Chef Solo provisioner.

Author:

Instance Attribute Summary

Attributes included from Configurable

#instance

Instance Method Summary collapse

Methods inherited from ChefBase

#check_license, #doctor, #init_command, #initialize, #install_command, #license_acceptance_id, #product_version

Methods inherited from Base

#call, #check_license, #cleanup_sandbox, #doctor, #init_command, #initialize, #install_command, kitchen_provisioner_api_version, #prepare_command, #sandbox_path

Methods included from Logging

#banner, #debug, #error, #fatal, #info, #warn

Methods included from Configurable

#[], #bourne_shell?, #calculate_path, #config_keys, #diagnose, #diagnose_plugin, #finalize_config!, included, #name, #powershell_shell?, #remote_path_join, #unix_os?, #verify_dependencies, #windows_os?

Methods inherited from Kitchen::Plugin::Base

no_parallel_for

Constructor Details

This class inherits a constructor from Kitchen::Provisioner::ChefBase

Instance Method Details

#config_filenameObject


43
44
45
# File 'lib/kitchen/provisioner/chef_solo.rb', line 43

def config_filename
  "solo.rb"
end

#create_sandboxObject

Creates a temporary directory on the local workstation into which provisioner related files and directories can be copied or created. The contents of this directory will be copied over to the instance before invoking the provisioner's run command. After this method completes, it is expected that the contents of the sandbox is complete and ready for copy to the remote instance.

Note: any subclasses would be well advised to call super first when overriding this method, for example:

Examples:

overriding `#create_sandbox`


class MyProvisioner < Kitchen::Provisioner::Base
  def create_sandbox
    super
    # any further file copies, preparations, etc.
  end
end

48
49
50
51
# File 'lib/kitchen/provisioner/chef_solo.rb', line 48

def create_sandbox
  super
  prepare_config_rb
end

#run_commandString

Generates a command string which will invoke the main provisioner command on the prepared instance. If no work is required, then `nil` will be returned.

Returns:

  • (String)

    a command string


54
55
56
57
58
59
# File 'lib/kitchen/provisioner/chef_solo.rb', line 54

def run_command
  cmd = sudo(config[:chef_solo_path]).dup
    .tap { |str| str.insert(0, "& ") if powershell_shell? }

  chef_cmd(cmd)
end