Sha256: 190cc27ba2efdeca9dce0a996551c32672f3da3c12d1815250b0842a6161d872

Contents?: true

Size: 792 Bytes

Versions: 31

Compression:

Stored size: 792 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

31 entries across 31 versions & 2 rubygems

Version Path
sshkit-1.23.2 lib/sshkit/runners/sequential.rb
sshkit-1.23.1 lib/sshkit/runners/sequential.rb
sshkit-1.23.0 lib/sshkit/runners/sequential.rb
sshkit-1.22.2 lib/sshkit/runners/sequential.rb
sshkit-1.22.1 lib/sshkit/runners/sequential.rb
sshkit-1.22.0 lib/sshkit/runners/sequential.rb
sshkit-1.21.7 lib/sshkit/runners/sequential.rb
honeybadger-5.4.0 vendor/bundle/ruby/3.2.0/gems/sshkit-1.21.6/lib/sshkit/runners/sequential.rb
sshkit-1.21.6 lib/sshkit/runners/sequential.rb
honeybadger-5.3.0 vendor/bundle/ruby/3.2.0/gems/sshkit-1.21.5/lib/sshkit/runners/sequential.rb
sshkit-1.21.5 lib/sshkit/runners/sequential.rb
sshkit-1.21.4 lib/sshkit/runners/sequential.rb
sshkit-1.21.3 lib/sshkit/runners/sequential.rb
sshkit-1.21.2 lib/sshkit/runners/sequential.rb
sshkit-1.21.1 lib/sshkit/runners/sequential.rb
sshkit-1.21.0 lib/sshkit/runners/sequential.rb
honeybadger-4.5.3 vendor/bundle/ruby/2.6.0/gems/sshkit-1.18.2/lib/sshkit/runners/sequential.rb
sshkit-1.20.0 lib/sshkit/runners/sequential.rb
sshkit-1.19.1 lib/sshkit/runners/sequential.rb
sshkit-1.19.0 lib/sshkit/runners/sequential.rb