From e1bbb201d895e72cc2830546c6ff12a3cf1be0ad Mon Sep 17 00:00:00 2001 From: Adam Grare Date: Wed, 1 Jul 2020 10:14:16 -0400 Subject: [PATCH] Move the systemd env var check into the systemd_worker? method When starting a worker we were checking an env var and settings, when stopping a worker we were just checking settings. This meant that if the env var wasn't set we would start the worker with spawn and try to stop it with systemd which will fail because the unit doesn't exist. --- app/models/miq_worker.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/miq_worker.rb b/app/models/miq_worker.rb index fdfa027d144..e984a8d0a76 100644 --- a/app/models/miq_worker.rb +++ b/app/models/miq_worker.rb @@ -316,7 +316,7 @@ def containerized_worker? end def self.systemd_worker? - MiqEnvironment::Command.supports_systemd? && supports_systemd? + ENV['MIQ_SYSTEMD_WORKERS'] && MiqEnvironment::Command.supports_systemd? && supports_systemd? end def systemd_worker? @@ -324,7 +324,7 @@ def systemd_worker? end def start_runner - if ENV['MIQ_SYSTEMD_WORKERS'] && systemd_worker? + if systemd_worker? start_systemd_worker elsif containerized_worker? start_runner_via_container