Class: SSHKit::Runner::Sequential
- Defined in:
- lib/sshkit/runners/sequential.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#wait_interval ⇒ Object
Returns the value of attribute wait_interval.
Attributes inherited from Abstract
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(hosts, options = nil, &block) ⇒ Sequential
constructor
A new instance of Sequential.
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, = nil, &block) super(hosts, , &block) @wait_interval = @options[:wait] || 2 end |
Instance Attribute Details
#wait_interval ⇒ Object
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
#execute ⇒ Object
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 |