Class: Kitchen::Driver::SSHBase
- Inherits:
-
Base
- Object
- Base
- Kitchen::Driver::SSHBase
show all
- Defined in:
- lib/kitchen/driver/ssh_base.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)
Direct Known Subclasses
Proxy
Instance Attribute Summary
Attributes inherited from Base
#instance
Instance Method Summary
collapse
Methods inherited from Base
#[], #config_keys, #diagnose, #initialize, #name, #validate_config!, #verify_dependencies
Methods included from ShellOut
#run_command
Instance Method Details
#converge(state) ⇒ Object
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
# File 'lib/kitchen/driver/ssh_base.rb', line 38
def converge(state)
provisioner = instance.provisioner
sandbox_dirs = Dir.glob("#{provisioner.create_sandbox}/*")
Kitchen::SSH.new(*build_ssh_args(state)) do |conn|
run_remote(provisioner.install_command, conn)
run_remote(provisioner.init_command, conn)
transfer_path(sandbox_dirs, provisioner[:root_path], conn)
run_remote(provisioner.prepare_command, conn)
run_remote(provisioner.run_command, conn)
end
ensure
provisioner && provisioner.cleanup_sandbox
end
|
#create(state) ⇒ Object
34
35
36
|
# File 'lib/kitchen/driver/ssh_base.rb', line 34
def create(state)
raise ClientError, "#{self.class}#create must be implemented"
end
|
#destroy(state) ⇒ Object
66
67
68
|
# File 'lib/kitchen/driver/ssh_base.rb', line 66
def destroy(state)
raise ClientError, "#{self.class}#destroy must be implemented"
end
|
#login_command(state) ⇒ Object
70
71
72
|
# File 'lib/kitchen/driver/ssh_base.rb', line 70
def login_command(state)
SSH.new(*build_ssh_args(state)).login_command
end
|
#setup(state) ⇒ Object
53
54
55
56
57
|
# File 'lib/kitchen/driver/ssh_base.rb', line 53
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
74
75
76
77
78
|
# File 'lib/kitchen/driver/ssh_base.rb', line 74
def ssh(ssh_args, command)
Kitchen::SSH.new(*ssh_args) do |conn|
run_remote(command, conn)
end
end
|
#verify(state) ⇒ Object
59
60
61
62
63
64
|
# File 'lib/kitchen/driver/ssh_base.rb', line 59
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
|