Handle bootstrapping of Poseidon when no environments

When starting Poseidon with an empty Nomad cluster, the list of existing environments is empty. In this case, however, our error handler threw an error, which was not correct.

Fixes CODEOCEAN-M7
This commit is contained in:
Sebastian Serth
2023-04-14 13:37:45 +02:00
parent c407d8cb8b
commit c59eaa05bb

View File

@ -27,12 +27,11 @@ class Runner::Strategy::Poseidon < Runner::Strategy
case response.status case response.status
when 200 when 200
response_body = parse response response_body = parse response
execution_environments = response_body[:executionEnvironments]
if execution_environments.nil? if response_body.key? :executionEnvironments
raise(Runner::Error::UnexpectedResponse.new("Could not get the list of execution environments in Poseidon, got response: #{response.as_json}")) raise(Runner::Error::UnexpectedResponse.new("Could not get the list of execution environments in Poseidon, got response: #{response.as_json}"))
else else
execution_environments response_body[:executionEnvironments] || []
end end
else else
handle_error response handle_error response