def test_ssh_connectivity
return true unless ssh_key_uploaded? || non_ssh_key_uploaded?
applications.take(1).each do |app|
begin
host, user = RHC::Helpers.ssh_string_parts(app.ssh_url)
ssh = Net::SSH.start(host, user, :timeout => 60)
rescue Interrupt => e
debug_error(e)
raise "Connection attempt to #{app.host} was interrupted"
rescue ::Exception => e
debug_error(e)
raise "An SSH connection could not be established to #{app.host}. Your SSH configuration may not be correct, or the application may not be responding. #{e.message} (#{e.class})"
ensure
ssh.close if ssh
end
end
true
end