Bug #30511
closedError only on production builds: The Dynflow world was not initialized yet. If your plugin uses it, make sure to call Rails.application.dynflow.require! in some initializer
Description
When running a rake task that includes the Katello::SubscriptionMailer, it fails with error:
RuntimeError (The Dynflow world was not initialized yet. If your plugin uses it, make sure to call Rails.application.dynflow.require! in some initializer)
Only seems to happen on nightly; not on devel boxes.
Steps to reproduce
- Import a manifest with at least one subscription that expires <180 days
- Attach that subscription to a host
- Run the Subscriptions - Entitlement Report (Monitor -> Report Templates) with Days from Now set appropriately
- Verify that the report shows that host and subscription
- In My Account -> Email Preferences, set up the Subscriptions Expiring Soon email and configure for Daily emails
- Run /usr/sbin/foreman-rake reports:daily
Expected: no output; if email is set up you are emailed the report
Actual: the error above
Alternate steps to reproduce (doesn't require a host/subscription)
In foreman-rake console, run
include Katello::SubscriptionMailerHelper
start_report_task(120)
Expected: return the job ID as a string
Actual: the error above
Workaround
See workaround in https://projects.theforeman.org/issues/29337#note-2
Updated by Jeremy Lenz over 4 years ago
full stack trace:
[root@sat-6-8-cee-rhel7 tasks]# /usr/sbin/foreman-rake reports:daily
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.6/lib/dynflow/rails.rb:75:in `world'
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.4.6/lib/dynflow/active_job/queue_adapter.rb:7:in `enqueue'
/opt/theforeman/tfm/root/usr/share/gems/gems/activejob-6.0.3.1/lib/active_job/enqueuing.rb:59:in `block in enqueue'
/opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.1/lib/active_support/callbacks.rb:112:in `block in run_callbacks'
/opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.1/lib/active_support/notifications.rb:180:in `block in instrument'
/opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.1/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
/opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.1/lib/active_support/notifications.rb:180:in `instrument'
/opt/theforeman/tfm/root/usr/share/gems/gems/activejob-6.0.3.1/lib/active_job/logging.rb:35:in `block (2 levels) in <module:Logging>'
/opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.1/lib/active_support/callbacks.rb:121:in `instance_exec'
/opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.1/lib/active_support/callbacks.rb:121:in `block in run_callbacks'
/opt/theforeman/tfm/root/usr/share/gems/gems/activejob-6.0.3.1/lib/active_job/logging.rb:16:in `block (3 levels) in <module:Logging>'
/opt/theforeman/tfm/root/usr/share/gems/gems/activejob-6.0.3.1/lib/active_job/logging.rb:47:in `tag_logger'
/opt/theforeman/tfm/root/usr/share/gems/gems/activejob-6.0.3.1/lib/active_job/logging.rb:15:in `block (2 levels) in <module:Logging>'
/opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.1/lib/active_support/callbacks.rb:121:in `instance_exec'
/opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.1/lib/active_support/callbacks.rb:121:in `block in run_callbacks'
/opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.1/lib/active_support/callbacks.rb:139:in `run_callbacks'
/opt/theforeman/tfm/root/usr/share/gems/gems/activejob-6.0.3.1/lib/active_job/enqueuing.rb:55:in `enqueue'
/opt/theforeman/tfm/root/usr/share/gems/gems/activejob-6.0.3.1/lib/active_job/enqueuing.rb:22:in `perform_later'
/usr/share/foreman/app/models/report_composer.rb:236:in `schedule_rendering'
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.16.0.rc4.1/app/helpers/katello/subscription_mailer_helper.rb:20:in `start_report_task'
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.16.0.rc4.1/app/mailers/katello/subscription_mailer.rb:17:in `subscription_expiry'
/opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.1/lib/abstract_controller/base.rb:195:in `process_action'
/opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.1/lib/abstract_controller/callbacks.rb:42:in `block in process_action'
/opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.1/lib/active_support/callbacks.rb:135:in `run_callbacks'
/opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.1/lib/abstract_controller/callbacks.rb:41:in `process_action'
/opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.1/lib/abstract_controller/base.rb:136:in `process'
/opt/theforeman/tfm/root/usr/share/gems/gems/actionmailer-6.0.3.1/lib/action_mailer/rescuable.rb:25:in `block in process'
/opt/theforeman/tfm/root/usr/share/gems/gems/actionmailer-6.0.3.1/lib/action_mailer/rescuable.rb:17:in `handle_exceptions'
/opt/theforeman/tfm/root/usr/share/gems/gems/actionmailer-6.0.3.1/lib/action_mailer/rescuable.rb:24:in `process'
/opt/theforeman/tfm/root/usr/share/gems/gems/actionview-6.0.3.1/lib/action_view/rendering.rb:39:in `process'
/opt/theforeman/tfm/root/usr/share/gems/gems/actionmailer-6.0.3.1/lib/action_mailer/base.rb:637:in `block in process'
/opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.1/lib/active_support/notifications.rb:180:in `block in instrument'
/opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.1/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
/opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.1/lib/active_support/notifications.rb:180:in `instrument'
/opt/theforeman/tfm/root/usr/share/gems/gems/actionmailer-6.0.3.1/lib/action_mailer/base.rb:636:in `process'
/opt/theforeman/tfm/root/usr/share/gems/gems/actionmailer-6.0.3.1/lib/action_mailer/message_delivery.rb:124:in `block in processed_mailer'
/opt/theforeman/tfm/root/usr/share/gems/gems/actionmailer-6.0.3.1/lib/action_mailer/message_delivery.rb:123:in `tap'
/opt/theforeman/tfm/root/usr/share/gems/gems/actionmailer-6.0.3.1/lib/action_mailer/message_delivery.rb:123:in `processed_mailer'
/opt/theforeman/tfm/root/usr/share/gems/gems/actionmailer-6.0.3.1/lib/action_mailer/message_delivery.rb:114:in `deliver_now'
/usr/share/foreman/app/models/mail_notifications/mail_notification.rb:52:in `deliver'
/usr/share/foreman/app/models/user_mail_notification.rb:13:in `deliver'
/usr/share/foreman/lib/tasks/reports.rake:106:in `block (2 levels) in process_notifications'
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.1/lib/active_record/relation/delegation.rb:87:in `each'
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.1/lib/active_record/relation/delegation.rb:87:in `each'
/usr/share/foreman/lib/tasks/reports.rake:105:in `block in process_notifications'
/usr/share/foreman/app/models/concerns/foreman/thread_session.rb:108:in `as'
/usr/share/foreman/app/models/concerns/foreman/thread_session.rb:114:in `as_anonymous_admin'
/usr/share/foreman/lib/tasks/reports.rake:104:in `process_notifications'
/usr/share/foreman/lib/tasks/reports.rake:112:in `block (2 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 => reports:daily
(See full trace by running task with --trace)
Updated by Samir Jha over 4 years ago
- Target version set to Katello 3.16.0
- Triaged changed from No to Yes
Updated by The Foreman Bot over 4 years ago
- Status changed from New to Ready For Testing
- Assignee set to Justin Sherrill
- Pull request https://github.com/Katello/katello/pull/8864 added
Updated by The Foreman Bot over 4 years ago
- Pull request https://github.com/Katello/katello/pull/8866 added
Updated by The Foreman Bot over 4 years ago
- Fixed in Releases Katello 3.18.0 added
Updated by Justin Sherrill over 4 years ago
- Status changed from Ready For Testing to Closed
Applied in changeset katello|582d5b228d39b11b8b074183be585b0c36e62969.