Module: Aptible::CLI::Helpers::Ssh

Included in:
Agent, Database, Operation
Defined in:
lib/aptible/cli/helpers/ssh.rb

Instance Method Summary collapse

Instance Method Details

#connect_to_ssh_portal(operation, *extra_ssh_args) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/aptible/cli/helpers/ssh.rb', line 5

def connect_to_ssh_portal(operation, *extra_ssh_args)
  # TODO: Should we rescue Interrupt here?
  with_ssh_cmd(operation) do |base_ssh_cmd|
    ssh_cmd = base_ssh_cmd + extra_ssh_args
    Kernel.system(*ssh_cmd)
  end
end

#with_ssh_cmd(operation) ⇒ Object



13
14
15
16
17
18
19
20
21
# File 'lib/aptible/cli/helpers/ssh.rb', line 13

def with_ssh_cmd(operation)
  ensure_ssh_dir!
  ensure_config!
  ensure_key!

  operation.with_ssh_cmd(private_key_file) do |cmd, connection|
    yield cmd + common_ssh_args, connection
  end
end