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
23 changes: 16 additions & 7 deletions bin/install
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ EOF
def check_ruby_version_and_symlink
@log.info("Starting Ruby version check.")
actual_ruby_version = RUBY_VERSION.split('.').map{|s|s.to_i}[0,2]

supported_ruby_versions.each do |version|
if ((actual_ruby_version <=> version.split('.').map{|s|s.to_i}) == 0)
return File.join(RbConfig::CONFIG["bindir"], RbConfig::CONFIG["RUBY_INSTALL_NAME"] + RbConfig::CONFIG["EXEEXT"])
Expand All @@ -109,13 +109,13 @@ EOF
end
end

unsupported_ruby_version_error
unsupported_ruby_version_error
exit(1)
end

def unsupported_ruby_version_error
@log.error("Current running Ruby version for "+ENV['USER']+" is "+RUBY_VERSION+", but Ruby version 2.x needs to be installed.")
@log.error('If you already have the proper Ruby version installed, please either create a symlink to /usr/bin/ruby2.x,')
@log.error('If you already have the proper Ruby version installed, please either create a symlink to /usr/bin/ruby2.x,')
@log.error( "or run this install script with right interpreter. Otherwise please install Ruby 2.x for "+ENV['USER']+" user.")
@log.error('You can get more information by running the script with --help option.')
end
Expand Down Expand Up @@ -243,13 +243,22 @@ EOF
uri = get_s3_uri(region, bucket, key)

# stream package file to disk
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|
package_file.write(s3.read)
package_file.write(s3.read)
end
rescue *exceptions => e
@log.error("Could not find package to download at '#{uri.to_s}' - Retrying... Attempt: '#{retries.to_s}'")
if (retries < 5)
sleep 2 ** retries
retries += 1
retry
else
@log.error("Could not download CodeDeploy Agent Package. Exiting Install script.")
exit(1)
end
rescue OpenURI::HTTPError => e
@log.error("Could not find package to download at '#{uri.to_s}'")
exit(1)
end
end

Expand Down