diff --git a/lib/runner/strategy/poseidon.rb b/lib/runner/strategy/poseidon.rb index c4df9c16..ac7f4f8b 100644 --- a/lib/runner/strategy/poseidon.rb +++ b/lib/runner/strategy/poseidon.rb @@ -152,7 +152,24 @@ class Runner::Strategy::Poseidon < Runner::Strategy end def self.release - nil + url = "#{config[:url]}/version" + Rails.logger.debug { "#{Time.zone.now.getutc.inspect}: Getting release from #{url}" } + response = http_connection.get url + case response.status + when 200 + JSON.parse(response.body) + when 404 + 'N/A' + else + handle_error response + end + rescue Faraday::Error => e + raise Runner::Error::FaradayError.new("Request to Poseidon failed: #{e.inspect}") + rescue JSON::ParserError => e + # Poseidon should not send invalid json + raise Runner::Error::UnexpectedResponse.new("Error parsing response from Poseidon: #{e.message}") + ensure + Rails.logger.debug { "#{Time.zone.now.getutc.inspect}: Finished getting release information" } end def self.pool_size