Module: Kitchen::Transport

Defined in:
lib/kitchen/transport.rb,
lib/kitchen/transport/ssh.rb,
lib/kitchen/transport/base.rb,
lib/kitchen/transport/exec.rb,
lib/kitchen/transport/dummy.rb,
lib/kitchen/transport/winrm.rb

Overview

A transport is responsible for the communication with an instance, that is remote comands and other actions such as file transfer, login, etc.

Author:

Defined Under Namespace

Classes: Base, Dummy, Exec, Ssh, SshFailed, TransportFailed, Winrm, WinrmFailed

Constant Summary collapse

DEFAULT_PLUGIN =

Default transport to use

"ssh".freeze

Class Method Summary collapse

Class Method Details

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

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

Parameters:

  • plugin (String)

    a transport plugin type, to be constantized

  • config (Hash)

    a configuration hash to initialize the transport

Returns:

Raises:

  • (ClientError)

    if a transport instance could not be created



37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/kitchen/transport.rb', line 37

def self.for_plugin(plugin, config)
  first_load = require("kitchen/transport/#{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}' transport from the load path." \
          " Please ensure that your transport is installed as a gem or" \
          " included in your Gemfile if using Bundler."
end