Class: SimpleDeploy::Stack::SSH

Inherits:
Object
  • Object
show all
Defined in:
lib/simple_deploy/stack/ssh.rb

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ SSH

Returns a new instance of SSH.



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/simple_deploy/stack/ssh.rb', line 8

def initialize(args)
  @config      = SimpleDeploy.config
  @logger      = SimpleDeploy.logger
  @stack       = args[:stack]
  @instances   = args[:instances]
  @environment = args[:environment]
  @ssh_user    = args[:ssh_user]
  @ssh_key     = args[:ssh_key]
  @name        = args[:name]
  @region      = @config.region
end

Instance Method Details

#execute(args) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/simple_deploy/stack/ssh.rb', line 20

def execute(args)
  return false if @instances.nil? || @instances.empty?
  create_execute_task args

  status = false

  begin
    @task.execute
    status = true
    @logger.info "Command executed against instances successfully."
  rescue ::Capistrano::CommandError => error
    @logger.error "Error running execute statement: #{error}"
  rescue ::Capistrano::ConnectionError => error
    @logger.error "Error connecting to instances: #{error}"
  rescue ::Capistrano::Error => error
    @logger.error "Error: #{error}"
  end

  status
end