Class: Kitchen::Provisioner::External

Inherits:
Base
  • Object
show all
Defined in:
lib/kitchen/provisioner/external.rb

Overview

Executes an external provisioner provider over the v1 stdio protocol.

Constant Summary collapse

PROTOCOL_VERSION =

The provider protocol version this provisioner speaks. A provider reporting any other version is rejected during capability negotiation.

Returns:

  • (String)

    a protocol version string

"1.0".freeze
RESULT_STATUSES =

The result statuses a provider may report for an action.

Returns:

  • (Array<String>)

    valid result statuses

%w{passed failed skipped}.freeze
LOG_LEVELS =

The log levels a provider may attach to a log message.

Returns:

  • (Array<String>)

    valid log levels

%w{debug info warn error}.freeze
INTERNAL_CONFIG_KEYS =

Configuration keys consumed by this provisioner itself, and so withheld from the configuration passed out to the provider.

Returns:

  • (Array<Symbol>)

    internal-only configuration keys

%i{
  command provider pass_env kitchen_root test_base_path
}.freeze
REDACTED_KEYS =

Configuration keys whose values are redacted before configuration is logged or handed to a provider.

Returns:

  • (Array<String>)

    keys to redact

%w{password ssh_http_proxy_password}.freeze

Instance Attribute Summary

Attributes included from Configurable

#instance

Instance Method Summary collapse

Methods inherited from Base

#check_license, #cleanup_sandbox, #create_sandbox, #doctor, #init_command, #initialize, #install_command, kitchen_provisioner_api_version, #prepare_command, #run_command, #sandbox_dirs, #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?

Constructor Details

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

Instance Method Details

#call(state) ⇒ Object

Runs the provisioner on the instance.

rubocop:disable Metrics/AbcSize

Parameters:

  • state (Hash)

    mutable instance state

Raises:



64
65
66
67
68
69
# File 'lib/kitchen/provisioner/external.rb', line 64

def call(state)
  verify_capabilities
  validate_provider(state)
  result = run_provider(state)
  persist_provider_state(state, result)
end

#provider_name_from_commandString

Derives the provider's name from the configured command, stripping any directory portion and the conventional kitchen-provider- prefix.

Returns:

  • (String)

    the provider name



75
76
77
78
# File 'lib/kitchen/provisioner/external.rb', line 75

def provider_name_from_command
  first_part = Shellwords.split(config[:command].to_s).first.to_s
  File.basename(first_part).sub(/^kitchen-provider-/, "")
end