class Serverkit::Backends::SshBackend

Constants

DEFAULT_SSH_OPTIONS

Attributes

host[R]

Public Class Methods

new(host: nil, ssh_options: nil, **args) click to toggle source

@param [String] host @param [Hash] ssh_options

Calls superclass method Serverkit::Backends::BaseBackend::new
# File lib/serverkit/backends/ssh_backend.rb, line 15
def initialize(host: nil, ssh_options: nil, **args)
  super(**args)
  @host = host
  @ssh_options = ssh_options
end

Private Instance Methods

specinfra_backend() click to toggle source

@return [Specinfra::Backend::Ssh]

# File lib/serverkit/backends/ssh_backend.rb, line 24
def specinfra_backend
  @specinfra_backend ||= ::Specinfra::Backend::Ssh.new(
    host: host,
    ssh_options: ssh_options,
    request_pty: true,
  )
end
ssh_options() click to toggle source

@return [Hash]

# File lib/serverkit/backends/ssh_backend.rb, line 33
def ssh_options
  { user: user }.merge(@ssh_options || DEFAULT_SSH_OPTIONS)
end
user() click to toggle source

@return [String]

# File lib/serverkit/backends/ssh_backend.rb, line 38
def user
  ::Net::SSH::Config.for(@host)[:user] || ::Etc.getlogin
end