Foreman-rake fails

Problem:
foreman-rake foreman_tasks:cleanup fails with error:

rake aborted!
The Dynflow world was not initialized yet. If your plugin uses it, make sure to call Rails.application.dynflow.require! in some initializer
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.4.2/lib/dynflow/rails.rb:75:in `world'
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-0.17.5/lib/foreman_tasks/cleaner.rb:80:in `initialize'
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-0.17.5/lib/foreman_tasks/cleaner.rb:8:in `new'
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-0.17.5/lib/foreman_tasks/cleaner.rb:8:in `run'
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-0.17.5/lib/foreman_tasks/tasks/cleanup.rake:37:in `block (3 levels) in <top (required)>'
/opt/rh/rh-ruby25/root/usr/share/gems/gems/rake-12.3.0/exe/rake:27:in `<top (required)>'
Tasks: TOP => foreman_tasks:cleanup => foreman_tasks:cleanup:run
(See full trace by running task with --trace)

full command:

foreman-rake foreman_tasks:cleanup TASK_SEARCH='label ~ *' AFTER='14d' VERBOSE=true NOOP=true

Verisons
OS: Centos 7.8
Foreman: 1.24.3
Katello: 3.14.1

Other relevant data:
foreman-maintain service status shows that all services are running

Hi,
thank you for pointing that out. We’re tracking it as Bug #30145: foreman-rake foreman_tasks:cleanup fails because Dynflow world is not initialized yet - foreman-tasks - Foreman, PRs for it are ready for review and it should be out in no time.

2 Likes

Hi, sorry to bump this subject but I’m facing the same issue, the PR are only for the newest version of foreman right ? is there a way to backport the fix in the Katello 3.14.3 ?

My issue is that I need to cleanup some bugged tasks and I don’t want to upgrade with those bugged tasks still running.
Kind regards,

Nevermind, I just backported the fix here :
https://projects.theforeman.org/projects/foreman-tasks/repository/revisions/b1929119a77179a634c8bda3434c7830ea95ec34/diff?utf8=✓&type=sbs

Sorry for the message