Class: Kitchen::Transport::Exec::Connection

Inherits:
Base::Connection show all
Includes:
ShellOut
Defined in:
lib/kitchen/transport/exec.rb

Overview

Fake connection which just does local operations.

Since:

  • 1.19

Instance Method Summary collapse

Methods included from ShellOut

#run_command

Methods inherited from Base::Connection

#download, #execute_with_retry, #initialize, #login_command, #retry?, #wait_until_ready

Methods included from Logging

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

Constructor Details

This class inherits a constructor from Kitchen::Transport::Base::Connection

Instance Method Details

#closeObject

Since:

  • 1.19


51
52
53
54
55
# File 'lib/kitchen/transport/exec.rb', line 51

def close
  if host_os_windows?
    FileUtils.remove(exec_script_file)
  end
end

#execute(command) ⇒ Object

Since:

  • 1.19


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

def execute(command)
  return if command.nil?

  if host_os_windows?
    run_command(run_from_file_command(command))
    close
  else
    run_command(command)
  end
end

#init_options(options) ⇒ Object

Since:

  • 1.19


70
71
72
73
74
# File 'lib/kitchen/transport/exec.rb', line 70

def init_options(options)
  super
  @instance_name = @options.delete(:instance_name)
  @kitchen_root = @options.delete(:kitchen_root)
end

#upload(locals, remote) ⇒ Object

“Upload” the files by copying them locally.

See Also:

  • Base#upload

Since:

  • 1.19


60
61
62
63
64
65
66
67
# File 'lib/kitchen/transport/exec.rb', line 60

def upload(locals, remote)
  # evaluate $env:temp on Windows
  real_remote = remote.to_s == "\$env:TEMP\\kitchen" ? kitchen_temp : remote
  FileUtils.mkdir_p(real_remote)
  Array(locals).each do |local|
    FileUtils.cp_r(local, real_remote)
  end
end