From 59bcade251fad160b0f69481c89815e1c143c1b1 Mon Sep 17 00:00:00 2001 From: Adam Grare Date: Thu, 15 Aug 2024 12:03:12 -0400 Subject: [PATCH] Start all automation runners in AutomationWorker --- app/models/automation_worker/runner.rb | 9 +++++++++ lib/vmdb/plugins.rb | 4 ++++ 2 files changed, 13 insertions(+) diff --git a/app/models/automation_worker/runner.rb b/app/models/automation_worker/runner.rb index 566947207fa..ca3baa97f1c 100644 --- a/app/models/automation_worker/runner.rb +++ b/app/models/automation_worker/runner.rb @@ -1,2 +1,11 @@ class AutomationWorker::Runner < MiqQueueWorkerBase::Runner + def do_before_work_loop + super + @automation_runners = Vmdb::Plugins.automation_runner_classes.map(&:runner) + end + + def before_exit(*) + super + @automation_runners.each(&:stop) + end end diff --git a/lib/vmdb/plugins.rb b/lib/vmdb/plugins.rb index 1912834df6a..bce1c8a8340 100644 --- a/lib/vmdb/plugins.rb +++ b/lib/vmdb/plugins.rb @@ -95,6 +95,10 @@ def automate_domains end end + def automation_runner_classes + @automation_runner_classes ||= flat_map { |engine| engine.try(:automation_runners) }.compact + end + def miq_widgets_content @miq_widgets_content ||= Dir.glob(Rails.root.join("product/dashboard/widgets/*")) + flat_map { |engine| content_directories(engine, "dashboard/widgets") } end