Project

General

Profile

Bug #30511

Error 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

Added by Jeremy Lenz 3 months ago. Updated 3 months ago.

Status:
Closed
Priority:
High
Category:
Subscriptions
Target version:
Difficulty:
Triaged:
Yes
Bugzilla link:

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

  1. Import a manifest with at least one subscription that expires <180 days
  2. Attach that subscription to a host
  3. Run the Subscriptions - Entitlement Report (Monitor -> Report Templates) with Days from Now set appropriately
  4. Verify that the report shows that host and subscription
  5. In My Account -> Email Preferences, set up the Subscriptions Expiring Soon email and configure for Daily emails
  6. 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

Associated revisions

Revision 582d5b22 (diff)
Added by Justin Sherrill 3 months ago

Fixes #30511 - force report task to be dynflow client

History

#1 Updated by Jeremy Lenz 3 months ago

  • Description updated (diff)

#2 Updated by Jeremy Lenz 3 months ago

  • Description updated (diff)

#3 Updated by Jeremy Lenz 3 months ago

  • Description updated (diff)

#4 Updated by Jeremy Lenz 3 months ago

  • Description updated (diff)

#5 Updated by Jeremy Lenz 3 months 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)

#6 Updated by Jeremy Lenz 3 months ago

  • Category set to Subscriptions

#7 Updated by Jeremy Lenz 3 months ago

  • Bugzilla link set to 1861816

#8 Updated by Samir Jha 3 months ago

  • Triaged changed from No to Yes
  • Target version set to Katello 3.16.0

#9 Updated by The Foreman Bot 3 months ago

  • Assignee set to Justin Sherrill
  • Status changed from New to Ready For Testing
  • Pull request https://github.com/Katello/katello/pull/8864 added

#10 Updated by The Foreman Bot 3 months ago

  • Pull request https://github.com/Katello/katello/pull/8866 added

#11 Updated by The Foreman Bot 3 months ago

  • Fixed in Releases Katello 3.18.0 added

#12 Updated by Justin Sherrill 3 months ago

  • Status changed from Ready For Testing to Closed

Also available in: Atom PDF