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 9d02ffa2943..8dbc10c36d9 100644 --- a/lib/vmdb/plugins.rb +++ b/lib/vmdb/plugins.rb @@ -93,6 +93,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 ||= Rails.root.join("product/dashboard/widgets").glob("*").map(&:to_s) + flat_map { |engine| content_directories(engine, "dashboard/widgets") } end