From 1a5d512689a167026f3ff2e33c454e435ae55b1c Mon Sep 17 00:00:00 2001 From: Sebastian Serth Date: Wed, 1 Dec 2021 18:41:29 +0100 Subject: [PATCH] Check Runner management status in execution environment updates --- app/models/execution_environment.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/models/execution_environment.rb b/app/models/execution_environment.rb index d6e0b5b6..64167dae 100644 --- a/app/models/execution_environment.rb +++ b/app/models/execution_environment.rb @@ -80,7 +80,7 @@ class ExecutionEnvironment < ApplicationRecord def validate_docker_image? # We only validate the code execution with the provided image if there is at least one container to test with. - pool_size.positive? && docker_image.present? && !Rails.env.test? + pool_size.positive? && docker_image.present? && !Rails.env.test? && Runner.management_active? end def working_docker_image? @@ -105,7 +105,7 @@ class ExecutionEnvironment < ApplicationRecord end def delete_runner_environment - Runner.strategy_class.remove_environment(self) + Runner.strategy_class.remove_environment(self) if Runner.management_active? rescue Runner::Error => e unless errors.include?(:docker_image) errors.add(:docker_image, "error: #{e}") @@ -115,7 +115,7 @@ class ExecutionEnvironment < ApplicationRecord def sync_runner_environment previous_saved_environment = self.class.find(id) - Runner.strategy_class.sync_environment(previous_saved_environment) + Runner.strategy_class.sync_environment(previous_saved_environment) if Runner.management_active? rescue Runner::Error => e unless errors.include?(:docker_image) errors.add(:docker_image, "error: #{e}")