Sha256: 8992d8e4a0f06804768d0ebbfccf21d38496e8e4245c057703e6862b8c842975

Contents?: true

Size: 577 Bytes

Versions: 8

Compression:

Stored size: 577 Bytes

Contents

# frozen_string_literal: true

module Capistrano
  module ASG
    module Rolling
      # SSH availability test.
      module SSH
        module_function

        def test?(ip_address, user, ssh_options)
          options = ssh_options || {}
          options[:timeout] = 10

          ::Net::SSH.start(ip_address, user, options) do |ssh|
            ssh.exec!('echo hello')
          end

          true
        rescue ::Net::SSH::ConnectionTimeout, ::Net::SSH::Proxy::ConnectError, Errno::ECONNREFUSED, Errno::ETIMEDOUT
          false
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
capistrano-asg-rolling-0.5.1 lib/capistrano/asg/rolling/ssh.rb
capistrano-asg-rolling-0.5.0 lib/capistrano/asg/rolling/ssh.rb
capistrano-asg-rolling-0.4.1 lib/capistrano/asg/rolling/ssh.rb
capistrano-asg-rolling-0.4.0 lib/capistrano/asg/rolling/ssh.rb
capistrano-asg-rolling-0.3.0 lib/capistrano/asg/rolling/ssh.rb
capistrano-asg-rolling-0.2.1 lib/capistrano/asg/rolling/ssh.rb
capistrano-asg-rolling-0.2.0 lib/capistrano/asg/rolling/ssh.rb
capistrano-asg-rolling-0.1.0 lib/capistrano/asg/rolling/ssh.rb