Sha256: 8f4c2a6f121e9e03d91f25e7210dfae6b3fdf6e451a4d03f537792135c2852e6
Contents?: true
Size: 790 Bytes
Versions: 7
Compression:
Stored size: 790 Bytes
Contents
module SSHKit module Runner class Sequential < Abstract attr_accessor :wait_interval def initialize(hosts, options = nil, &block) super(hosts, options, &block) @wait_interval = @options[:wait] || 2 end 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 private def run_backend(host, &block) backend(host, &block).run rescue StandardError => e e2 = ExecuteError.new e raise e2, "Exception while executing #{host.user ? "as #{host.user}@" : "on host "}#{host}: #{e.message}" end end end end
Version data entries
7 entries across 7 versions & 1 rubygems