Class: SSHKit::Runner::Sequential

Inherits:
Abstract
  • Object
show all
Defined in:
lib/sshkit/runners/sequential.rb

Direct Known Subclasses

Group

Instance Attribute Summary collapse

Attributes inherited from Abstract

#block, #hosts, #options

Instance Method Summary collapse

Constructor Details

#initialize(hosts, options = nil, &block) ⇒ Sequential

Returns a new instance of Sequential.



8
9
10
11
# File 'lib/sshkit/runners/sequential.rb', line 8

def initialize(hosts, options = nil, &block)
  super(hosts, options, &block)
  @wait_interval = @options[:wait] || 2
end

Instance Attribute Details

#wait_intervalObject

Returns the value of attribute wait_interval.



6
7
8
# File 'lib/sshkit/runners/sequential.rb', line 6

def wait_interval
  @wait_interval
end

Instance Method Details

#executeObject



13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/sshkit/runners/sequential.rb', line 13

def execute
  last_host = hosts.pop

  hosts.each do |host|
    run_backend(host, &block)
    sleep wait_interval
  end

  unless last_host.nil?
    run_backend(last_host, &block)
  end
end