Class: Kitchen::Driver::SSHBaseGzip

Inherits:
Base
  • Object
show all
Defined in:
lib/kitchen/driver/ssh_base_gzip.rb

Overview

Base class for a driver that uses SSH to communication with an instance. A subclass must implement the following methods:

  • #create(state)

  • #destroy(state)

Author:

Direct Known Subclasses

SshGzip

Instance Method Summary collapse

Instance Method Details

#converge(state) ⇒ Object



43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/kitchen/driver/ssh_base_gzip.rb', line 43

def converge(state)
  provisioner = instance.provisioner
  provisioner.create_sandbox

  Kitchen::SSH.new(*build_ssh_args(state)) do |conn|
    run_remote(provisioner.install_command, conn)
    run_remote(provisioner.init_command, conn)
    do_sandbox_transfer provisioner, conn
    run_remote(provisioner.prepare_command, conn)
    run_remote(provisioner.run_command, conn)
  end
ensure
  provisioner && provisioner.cleanup_sandbox
end

#create(state) ⇒ Object

Raises:

  • (ClientError)


38
39
40
# File 'lib/kitchen/driver/ssh_base_gzip.rb', line 38

def create(state) # rubocop:disable Lint/UnusedMethodArgument
  raise ClientError, "#{self.class}#create must be implemented"
end

#destroy(state) ⇒ Object

Raises:

  • (ClientError)


74
75
76
# File 'lib/kitchen/driver/ssh_base_gzip.rb', line 74

def destroy(state) # rubocop:disable Lint/UnusedMethodArgument
  raise ClientError, "#{self.class}#destroy must be implemented"
end

#login_command(state) ⇒ Object



79
80
81
# File 'lib/kitchen/driver/ssh_base_gzip.rb', line 79

def (state)
  SSH.new(*build_ssh_args(state)).
end

#remote_command(state, command) ⇒ Object

Executes an arbitrary command on an instance over an SSH connection.

Parameters:

  • state (Hash)

    mutable instance and driver state

  • command (String)

    the command to be executed

Raises:

  • (ActionFailed)

    if the command could not be successfully completed



88
89
90
91
92
# File 'lib/kitchen/driver/ssh_base_gzip.rb', line 88

def remote_command(state, command)
  Kitchen::SSH.new(*build_ssh_args(state)) do |conn|
    run_remote(command, conn)
  end
end

#setup(state) ⇒ Object



59
60
61
62
63
# File 'lib/kitchen/driver/ssh_base_gzip.rb', line 59

def setup(state)
  Kitchen::SSH.new(*build_ssh_args(state)) do |conn|
    run_remote(busser.setup_cmd, conn)
  end
end

#ssh(ssh_args, command) ⇒ Object

Deprecated.

This method should no longer be called directly and exists to support very old drivers. This will be removed in the future.

**(Deprecated)** Executes a remote command over SSH.

Parameters:

  • ssh_args (Array)

    ssh arguments

  • command (String)

    remote command to invoke



100
101
102
103
104
# File 'lib/kitchen/driver/ssh_base_gzip.rb', line 100

def ssh(ssh_args, command)
  Kitchen::SSH.new(*ssh_args) do |conn|
    run_remote(command, conn)
  end
end

#verify(state) ⇒ Object



66
67
68
69
70
71
# File 'lib/kitchen/driver/ssh_base_gzip.rb', line 66

def verify(state)
  Kitchen::SSH.new(*build_ssh_args(state)) do |conn|
    run_remote(busser.sync_cmd, conn)
    run_remote(busser.run_cmd, conn)
  end
end