1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

[dynect|dns] Fixes exception behavior for 307's

This commit is contained in:
Nick Janus 2014-06-24 17:00:55 -04:00
parent 0cf4a25de7
commit 4ee7465679

View file

@ -120,19 +120,24 @@ module Fog
def poll_job(response, original_expects, time_to_wait = 10)
job_location = response.headers['Location']
Fog.wait_for(time_to_wait) do
response = request(
:expects => original_expects,
:idempotent => true,
:method => :get,
:path => job_location
)
response.body['status'] != 'incomplete'
end
if response.body['status'] == 'incomplete'
raise JobIncomplete.new("Job #{response.body['job_id']} is still incomplete")
begin
Fog.wait_for(time_to_wait) do
response = request(
:expects => original_expects,
:idempotent => true,
:method => :get,
:path => job_location
)
response.body['status'] != 'incomplete'
end
rescue Errors::TimeoutError => error
if response.body['status'] == 'incomplete'
raise JobIncomplete.new("Job #{response.body['job_id']} is still incomplete")
else
raise error
end
end
response