From c59eaa05bb0345bde3ec08a49c1a31b4abec6fa2 Mon Sep 17 00:00:00 2001 From: Sebastian Serth Date: Fri, 14 Apr 2023 13:37:45 +0200 Subject: [PATCH] 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 --- lib/runner/strategy/poseidon.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/runner/strategy/poseidon.rb b/lib/runner/strategy/poseidon.rb index 54ccf526..1f222a5b 100644 --- a/lib/runner/strategy/poseidon.rb +++ b/lib/runner/strategy/poseidon.rb @@ -27,12 +27,11 @@ class Runner::Strategy::Poseidon < Runner::Strategy case response.status when 200 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}")) else - execution_environments + response_body[:executionEnvironments] || [] end else handle_error response