Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge remote branch 'origin/teal_13_2_acu76466_sender_retry_when_brok…

…er_down_master'

Conflicts:
	Gemfile.lock
	lib/instance/cook/repose_downloader.rb
	spec/instance/instance/cook/repose_downloader_spec.rb
  • Loading branch information...
commit 09847f73ad8a5b35bbb0aa0dc89061b6c3d4d901 2 parents ab73304 + 71a8d20
Ryan Williamson ryanwilliamson authored
19 Gemfile.lock
View
@@ -1,12 +1,12 @@
GIT
remote: git://github.com/rightscale/right_agent.git
- revision: 2ff982d1dad6184c738145bf816f299b24a0dd96
+ revision: fa809de7a4fd6c7cf6ce6fa90c003c1763e3ea62
branch: master
specs:
- right_agent (0.14.0)
+ right_agent (0.14.2)
eventmachine (>= 0.12.10, < 2.0)
json (~> 1.4)
- msgpack (= 0.4.4)
+ msgpack (~> 0.5)
net-ssh (~> 2.0)
right_amqp (~> 0.4)
right_popen (~> 1.0.11)
@@ -14,19 +14,19 @@ GIT
GIT
remote: git://github.com/rightscale/right_amqp.git
- revision: e34b6aa4cfdc0013df736bacd27d84f756338108
+ revision: 84fd7546ea350a1ad72913ff1badb717769ad402
branch: master
specs:
- right_amqp (0.5.3)
+ right_amqp (0.6.0)
eventmachine (>= 0.12.10, < 2.0)
right_support (>= 1.2, < 3.0)
GIT
remote: git://github.com/rightscale/right_support.git
- revision: e844c798d3fe4ad5f223731ac8af4d91c0753a20
+ revision: 35987e233a01a6d23afb05359f6b9307595243fa
branch: master
specs:
- right_support (2.6.5)
+ right_support (2.6.17)
PATH
remote: .
@@ -103,9 +103,8 @@ GEM
mixlib-shellout (1.0.0.1)
right_popen (~> 1.0, >= 1.0.21)
moneta (0.6.0)
- msgpack (0.4.4)
- msgpack (0.4.4-x86-mswin32)
- net-ssh (2.6.1)
+ msgpack (0.5.2)
+ net-ssh (2.6.5)
net-ssh-gateway (1.1.0)
net-ssh (>= 1.99.1)
net-ssh-multi (1.1)
28 lib/instance/cook/repose_downloader.rb
View
@@ -30,6 +30,10 @@ class ReposeDownloader
# Environment variables to examine for proxy settings, in order.
PROXY_ENVIRONMENT_VARIABLES = ['HTTPS_PROXY', 'HTTP_PROXY', 'http_proxy', 'ALL_PROXY']
+ # Class names of exceptions to be re-raised as a ConnectionException
+ CONNECTION_EXCEPTIONS = ['Errno::ECONNREFUSED', 'Errno::ETIMEDOUT', 'SocketError',
+ 'RestClient::InternalServerError', 'RestClient::RequestTimeout']
+
class ConnectionException < Exception; end
class DownloadException < Exception; end
@@ -106,9 +110,10 @@ def download(resource)
end
end
rescue Exception => e
- message = parse_exception_message(e)
+ list = parse_exception_message(e)
+ message = list.join(", ")
logger.error("Request '#{sanitized_resource}' failed - #{message}")
- raise ConnectionException, message if message.include?('Errno::ECONNREFUSED') || message.include?('Errno::ETIMEDOUT') || message.include?('SocketError') || message.include?('RestClient::InternalServerError') || message.include?('RestClient::RequestTimeout')
+ raise ConnectionException, message unless (list & CONNECTION_EXCEPTIONS).empty?
raise DownloadException, message
end
end
@@ -182,22 +187,19 @@ def parse_resource(resource)
#
# === Parameters
# @param [Exception] Exception to parse
-
+ #
# === Return
- # @return [Array] result as a list of exception class names
+ # @return [Array] List of exception class names
def parse_exception_message(e)
result = nil
if e.kind_of?(RightSupport::Net::NoResult)
- if e.respond_to?(:details) # right_support v2.6+
- # details is a map of host IP to an array of HTTP exceptions
- details = e.details
- result = details.values.flatten.map { |http_error| http_error.class.name }.uniq
- else
- result = e.message.split("Exceptions: ")[1]
- end
+ # Expected format of exception message: "... endpoints: ('<ip address>' => <exception class name array>, ...)""
+ i = 0
+ e.message.split(/\[|\]/).select {((i += 1) % 2) == 0 }.map { |s| s.split(/,\s*/) }.flatten
+ else
+ [e.class.name]
end
- result || [e.class.name]
end
# Create and return a RequestBalancer instance
@@ -294,4 +296,4 @@ def scale(value)
end
-end
+end
17 spec/instance/instance/cook/repose_downloader_spec.rb
View
@@ -169,23 +169,14 @@ module RightScale
end
it 'should parse a single RequestBalancer exception' do
- details = {
- "174.129.36.231" => [SocketError.new],
- "174.129.37.65" => [SocketError.new],
- }
- message = 'RequestBalancer: No available endpoints from ["174.129.36.231", "174.129.37.65"]! Exceptions: SocketError'
- e = RightSupport::Net::NoResult.new(message, details)
+ e = RightSupport::Net::NoResult.new("Request failed after 2 tries to 1 endpoint: ('174.129.36.231' => [SocketError])")
subject.send(:parse_exception_message, e).should == ["SocketError"]
end
it 'should parse multiple RequestBalancer exceptions' do
- message = 'RequestBalancer: No available endpoints from ["174.129.36.231", "174.129.37.65"]! Exceptions: RestClient::InternalServerError, RestClient::ResourceNotFound'
- details = {
- "174.129.36.231" => [RestClient::InternalServerError.new],
- "174.129.37.65" => [RestClient::ResourceNotFound.new],
- }
- e = RightSupport::Net::NoResult.new(message, details)
- subject.send(:parse_exception_message, e).sort.should == ["RestClient::InternalServerError", "RestClient::ResourceNotFound"]
+ e = RightSupport::Net::NoResult.new("Request failed after 2 tries to 2 endpoints: ('174.129.36.231' => [SocketError], " +
+ "'174.129.37.65' => [RestClient::InternalServerError, RestClient::ResourceNotFound])")
+ subject.send(:parse_exception_message, e).should == ["SocketError", "RestClient::InternalServerError", "RestClient::ResourceNotFound"]
end
end

1 comment on commit 09847f7

rightscale-ci
Collaborator

RS-COMPLIANCE: COMPLIANCE-COMMITMESSAGE-PASS Build: #15135(2013-04-01_06-20-45), repo: right_link, branch/tag: aqua_acu78536_productize, sha: 09847f7, status: PASS, reason: Was a merge commit

Please sign in to comment.
Something went wrong with that request. Please try again.