Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions bin/install
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,16 @@ EOF
['2.4', '2.3', '2.2', '2.1', '2.0']
end

def http_connection_options
{
:ssl_verify_mode => OpenSSL::SSL::VERIFY_PEER,
:redirect => true,
:open_timeout => 3,
:read_timeout => 120,
:proxy => @http_proxy
}
end

# check ruby version, only version 2.x works
def check_ruby_version_and_symlink
@log.info("Starting Ruby version check.")
Expand Down Expand Up @@ -199,7 +209,7 @@ EOF
def get_ec2_metadata_region
begin
uri = URI.parse('http://169.254.169.254/latest/meta-data/placement/availability-zone')
az = uri.read(:read_timeout => 120)
az = uri.read(:open_timeout => 3, :read_timeout => 120)
az.strip
rescue
@log.warn("Could not get region from EC2 metadata service at '#{uri.to_s}'")
Expand Down Expand Up @@ -246,7 +256,7 @@ EOF
retries ||= 0
exceptions = [OpenURI::HTTPError, OpenSSL::SSL::SSLError]
begin
uri.open(:ssl_verify_mode => OpenSSL::SSL::VERIFY_PEER, :redirect => true, :read_timeout => 120, :proxy => @http_proxy) do |s3|
uri.open(http_connection_options) do |s3|
package_file.write(s3.read)
end
rescue *exceptions => e
Expand All @@ -270,7 +280,7 @@ end
begin
require 'json'

version_string = uri.read(:ssl_verify_mode => OpenSSL::SSL::VERIFY_PEER, :redirect => true, :read_timeout => 120, :proxy => @http_proxy)
version_string = uri.read(http_connection_options)
JSON.parse(version_string)
rescue OpenURI::HTTPError => e
@log.error("Could not find version file to download at '#{uri.to_s}'")
Expand Down