Merge pull request #55 from highb/add_handling_for_failed_modify_request

Update pooler provider to throw an exception if the API returns non-OK
This commit is contained in:
Brian Cain 2019-12-05 08:02:06 -08:00 committed by GitHub
commit 7d0a72517b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -72,7 +72,14 @@ class Pooler
end
res_body = JSON.parse(response.body)
if res_body['ok']
res_body
elsif response.status == 401
raise AuthError, "HTTP #{response.status}: The token provided could not authenticate to the pooler.\n#{res_body}"
else
raise ModifyError, "HTTP #{response.status}: Failed to modify VMs from the pooler vm/#{hostname}. #{res_body}"
end
end
def self.disk(verbose, url, hostname, token, disk)