Skip to content

Commit

Permalink
Fix uninitialized ForemanTasks constants
Browse files Browse the repository at this point in the history
ForemanTasks::Task constants are loaded seperately and become available
after the build_middleware_stack hook. We gotta wait for the hook before
we can access ForemanTasks::Task to add the ResourceQuota async tasks.
  • Loading branch information
bastian-src committed Jan 15, 2025
1 parent 05e32cb commit 08af185
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/foreman_resource_quota/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ class Engine < ::Rails::Engine
end

# Register ForemanTasks-based recurring logic/scheduled tasks
initializer 'foreman_resource_quota.register_scheduled_tasks', before: :finisher_hook do |_app|
initializer 'foreman_resource_quota.register_scheduled_tasks',
before: :finisher_hook,
after: :build_middleware_stack do |_app| # ForemanTasks::Task becomes only available after this hook
action_paths = [ForemanResourceQuota::Engine.root.join('lib/foreman_resource_quota/async')]
::ForemanTasks.dynflow.config.eager_load_paths.concat(action_paths)

Expand Down

0 comments on commit 08af185

Please sign in to comment.