From b5638c75883cf5b1b2f2718e542687cfa432ea5d Mon Sep 17 00:00:00 2001 From: Adam Ruzicka Date: Thu, 23 May 2024 15:56:35 +0200 Subject: [PATCH] Fixes #37503 - Delay plugin finalization until seeds are seeded Moving it to a different file alphabetically after seeds.rb makes the callback finalizing plugin end up being put after the callback that does the seeding. --- config/initializers/foreman.rb | 4 ---- config/initializers/y_finalize_plugins.rb | 3 +++ 2 files changed, 3 insertions(+), 4 deletions(-) create mode 100644 config/initializers/y_finalize_plugins.rb diff --git a/config/initializers/foreman.rb b/config/initializers/foreman.rb index 8ba663c4c88..bc7f953fb84 100644 --- a/config/initializers/foreman.rb +++ b/config/initializers/foreman.rb @@ -23,10 +23,6 @@ Rails.application.config.after_initialize do Foreman.settings.load_values unless Foreman.in_setup_db_rake? || !(Setting.table_exists? rescue false) - - Foreman::Plugin.registered_plugins.each do |_name, plugin| - plugin.finalize_setup! - end end Rails.application.config.to_prepare do diff --git a/config/initializers/y_finalize_plugins.rb b/config/initializers/y_finalize_plugins.rb new file mode 100644 index 00000000000..9eb48ed64d6 --- /dev/null +++ b/config/initializers/y_finalize_plugins.rb @@ -0,0 +1,3 @@ +Rails.application.config.after_initialize do + Foreman::Plugin.registered_plugins.each_value(&:finalize_setup!) +end