Class: Shiplane::Host

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Includes:
SSHKit::DSL
Defined in:
lib/shiplane/host.rb

Constant Summary collapse

SSHKIT_PROPERTIES =
%i(user password keys hostname port ssh_options)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(role, env) ⇒ Host

Returns a new instance of Host.



15
16
17
18
# File 'lib/shiplane/host.rb', line 15

def initialize(role, env)
  @role = role
  @env = env
end

Instance Attribute Details

#envObject

Returns the value of attribute env.



9
10
11
# File 'lib/shiplane/host.rb', line 9

def env
  @env
end

#hostObject

Returns the value of attribute host.



9
10
11
# File 'lib/shiplane/host.rb', line 9

def host
  @host
end

#roleObject

Returns the value of attribute role.



9
10
11
# File 'lib/shiplane/host.rb', line 9

def role
  @role
end

Instance Method Details

#capistrano_roleObject



24
25
26
27
28
# File 'lib/shiplane/host.rb', line 24

def capistrano_role
  @capistrano_role ||= role.dup.tap do |r|
    r.properties.set(:ssh_options, ssh_options)
  end
end

#requires_sudo?Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/shiplane/host.rb', line 36

def requires_sudo?
  @requires_sudo ||= config.fetch('requires_sudo', false)
end

#sshkit_valuesObject



30
31
32
33
34
# File 'lib/shiplane/host.rb', line 30

def sshkit_values
  {
    interaction_handler: { "[sudo] password for #{user}: " => "#{password}\n" }
  }
end