Class: Kitchen::Transport::ExpressSsh::Connection

Inherits:
Ssh::Connection
  • Object
show all
Includes:
Kitchen::Transport::Express::Archiver
Defined in:
lib/kitchen/transport/express_ssh.rb

Overview

This connection instance overrides the default behavior of the upload method in Kitchen::Transport::Ssh::Connection to provide the zip-and-ship style transfer of files to the kitchen instances. All other behavior from the superclass is default.

Author:

Instance Method Summary collapse

Methods included from Kitchen::Transport::Express::Archiver

#archive, #extract

Instance Method Details

#upload(locals, remote) ⇒ Object

Overrides the upload method in Kitchen::Transport::Ssh::Connection The special sauce here is that we create threaded executions of uploading our archives

rubocop: disable Metrics/MethodLength

Parameters:

  • locals (Array)

    the top-level list of directories and files to be transfered

  • remote (String)

    the remote directory config

Raises:



99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# File 'lib/kitchen/transport/express_ssh.rb', line 99

def upload(locals, remote)
  return super unless valid_remote_requirements?(remote)

  processed_locals = process_locals(locals)
  pool, exceptions = thread_pool(processed_locals)
  processed_locals.each do |local|
    pool.post do
      transfer(local, remote, session.options)
    rescue => e
      exceptions << e.cause
    end
  end
  pool.shutdown
  pool.wait_for_termination

  raise ExpressFailed, exceptions.pop unless exceptions.empty?
end