Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1369817 - Email notification fails for Satellite Promotion and Satellite Sync Summary
Summary: Email notification fails for Satellite Promotion and Satellite Sync Summary
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Email
Version: 6.2.0
Hardware: x86_64
OS: Linux
high
medium
Target Milestone: Unspecified
Assignee: Justin Sherrill
QA Contact: Bruno Rocha
URL:
Whiteboard:
Depends On:
Blocks: 1122832 CEE_Sat6_Top_BZs, GSS_Sat6_Top_Bugs 1417069
TreeView+ depends on / blocked
 
Reported: 2016-08-24 13:23 UTC by anerurka
Modified: 2021-12-10 14:43 UTC (History)
16 users (show)

Fixed In Version: rubygem-katello-3.0.0.105-1
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1417069 (view as bug list)
Environment:
Last Closed: 2017-03-06 08:27:52 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
foreman-debug (5.72 MB, application/octet-stream)
2016-10-19 19:59 UTC, Og Maciel
no flags Details
foreman-debug-6.2.8-3.0 (975.12 KB, application/x-xz)
2017-02-21 20:42 UTC, Bruno Rocha
no flags Details
Email received (73.78 KB, image/png)
2017-03-02 18:21 UTC, Bruno Rocha
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 16303 0 Normal Closed sync and publish emails are never sent 2020-04-17 15:35:48 UTC
Red Hat Knowledge Base (Solution) 2575831 0 None None None 2016-09-16 22:38:13 UTC
Red Hat Product Errata RHBA-2017:0447 0 normal SHIPPED_LIVE Satellite 6.2.8 Async Bug Release 2017-03-06 13:23:41 UTC

Description anerurka 2016-08-24 13:23:55 UTC
Description of problem:

Email notification fails for Satellite Promotion  and Satellite Sync Summary 


Version-Release number of selected component (if applicable):

Satellite 6.2

How reproducible:

Always


Steps to Reproduce:

1.Configure Satellite 6.2 with smtp settings.
2.Register one or two clients.(Install katello-agent)
3. Sync any Repository
4. Publish or Promote Content View


Actual results:

No email notification received to the user email id


Expected results

Email Notification should be received


Additional info:
It works fine on Satellite 6.1.9, please check the attached image.

Comment 3 Bryan Kearney 2016-08-29 18:23:30 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue http://projects.theforeman.org/issues/16303 has been resolved.

Comment 5 Og Maciel 2016-10-19 19:44:57 UTC
This fails for me on Satellite 6.3.0 SNAP 5.0 with the following error:

==> /var/log/foreman/production.log <==
2016-10-19 15:36:00  [app] [E] Unable to send errata e-mail notification: undefined method `deliver_now' for #<MailNotification:0x0000000d83edb8>

The fix for this issue seems to be:

diff --git a/app/lib/actions/katello/content_view/errata_mail.rb b/app/lib/actions/katello/content_view/errata_mail.rb
index beb41e7..9f66672 100644
--- a/app/lib/actions/katello/content_view/errata_mail.rb
+++ b/app/lib/actions/katello/content_view/errata_mail.rb
@@ -11,10 +11,10 @@ def run
 
           content_view = ::Katello::ContentView.find(input[:content_view])
           environment = ::Katello::KTEnvironment.find(input[:environment])
-          users = ::User.select { |user| user.receives?(:katello_promote_errata) && user.can?(:view_content_views, content_view) }
+          users = ::User.select { |user| user.receives?(:promote_errata) && user.can?(:view_content_views, content_view) }
 
           begin
-            MailNotification[:katello_promote_errata].deliver_now(:users => users, :content_view => content_view, :environment => environment) unless users.blank?
+            MailNotification[:promote_errata].deliver_now(:users => users, :content_view => content_view, :environment => environment) unless users.blank?
           rescue => e
             message = _('Unable to send errata e-mail notification: %{error}' % {:error => e})
             Rails.logger.error(message)
diff --git a/app/lib/actions/katello/repository/errata_mail.rb b/app/lib/actions/katello/repository/errata_mail.rb
index 5bebc32..8550ad4 100644
--- a/app/lib/actions/katello/repository/errata_mail.rb
+++ b/app/lib/actions/katello/repository/errata_mail.rb
@@ -13,11 +13,11 @@ def run
           ::User.current = ::User.anonymous_admin
 
           repo = ::Katello::Repository.find(input[:repo])
-          users = ::User.select { |user| user.receives?(:katello_sync_errata) && user.can?(:view_products, repo.product) }.compact
+          users = ::User.select { |user| user.receives?(:sync_errata) && user.can?(:view_products, repo.product) }.compact
           errata = ::Katello::Erratum.where(:id => repo.repository_errata.where('katello_repository_errata.updated_at > ?', input[:last_updated].to_datetime).pluck(:erratum_id))
 
           begin
-            MailNotification[:katello_sync_errata].deliver_now(:users => users, :repo => repo, :errata => errata) unless users.blank?
+            MailNotification[:sync_errata].deliver_now(:users => users, :repo => repo, :errata => errata) unless users.blank?
           rescue => e
             message = _('Unable to send errata e-mail notification: %{error}' % {:error => e})
             Rails.logger.error(message)

and I can verify that these changes are in my system:


# rpm -ql tfm-rubygem-katello-3.2.0-0.2.rc2.el7.noarch |grep mail.rb
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.2.0.rc2/app/lib/actions/katello/content_view/errata_mail.rb
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.2.0.rc2/app/lib/actions/katello/repository/errata_mail.rb

# sed '14!d' /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.2.0.rc2/app/lib/actions/katello/content_view/errata_mail.rb
          users = ::User.select { |user| user.receives?(:promote_errata) && user.can?(:view_content_views, content_view) }

# sed '17!d' /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.2.0.rc2/app/lib/actions/katello/content_view/errata_mail.rb
            MailNotification[:promote_errata].deliver_now(:users => users, :content_view => content_view, :environment => environment) unless users.blank?

# sed '16!d' /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.2.0.rc2/app/lib/actions/katello/repository/errata_mail.rb
          users = ::User.select { |user| user.receives?(:sync_errata) && user.can?(:view_products, repo.product) }.compact

# sed '20!d' /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.2.0.rc2/app/lib/actions/katello/repository/errata_mail.rb
            MailNotification[:sync_errata].deliver_now(:users => users, :repo => repo, :errata => errata) unless users.blank?

Comment 6 Og Maciel 2016-10-19 19:59:47 UTC
Created attachment 1212252 [details]
foreman-debug

# foreman-debug
Processing... (takes a while)cp: '/etc/foreman-installer/scenarios.d/foreman.migrations/.applied' and '/tmp/foreman-debug-Ta6Ob/etc/foreman-installer/scenarios.d/foreman.migrations/.applied' are the same file
Exporting tasks, this may take a few minutes.
Copying entire file: /tmp/task-export-1476907080.tar.gz


 HOSTNAME: ibm-x3250m4-03.lab.eng.rdu2.redhat.com
       OS: redhat
  RELEASE: Red Hat Enterprise Linux Server release 7.2 (Maipo)
  FOREMAN: 1.13.0
     RUBY: ruby 2.0.0p598 (2014-11-13) [x86_64-linux]
   PUPPET: 3.8.6
  DENIALS: 20


A debug file has been created: /tmp/foreman-debug-Ta6Ob.tar.xz (5996612 bytes)

To upload a tarball to our secure site, please use the -u option.

Comment 7 Og Maciel 2016-10-19 20:00:29 UTC
Talked to jsherrill and he agreed that we should FailQE this issue. Attached logs as requested on irc

Comment 12 Peter Vreman 2017-01-04 11:34:03 UTC
I have applied the patch from https://github.com/Katello/katello/pull/6278 on Sat6.2.6 and that works.

Comment 13 Shlomi Zadok 2017-01-04 12:57:17 UTC
@peter++

Moving to POST :)

Comment 15 Og Maciel 2017-02-21 20:08:45 UTC
Still seeing 2017-02-21 15:07:48 [app] [E] Unable to send errata e-mail notification: undefined method `deliver_now' for #<MailNotification:0x0000000dd66480>

Comment 16 Bruno Rocha 2017-02-21 20:42:32 UTC
Created attachment 1256244 [details]
foreman-debug-6.2.8-3.0

Comment 17 Bruno Rocha 2017-02-21 20:51:50 UTC
Failed QE in:

6.2.8 3.0

foreman-installer-katello-3.0.0.77-1.el7sat.noarch.rpm
katello-installer-base-3.0.0.77-1.el7sat.noarch.rpm
ostree-2017.1-2.atomic.el7.x86_64.rpm
tfm-rubygem-katello-3.0.0.103-1.el7sat.noarch.rpm
tfm-rubygem-katello_ostree-3.0.0.103-1.el7sat.noarch.rpm
tfm-rubygem-unicode-display_width-1.0.5-2.el7sat.noarch.rpm


Steps:

1) Created new user and subscribed to "Promote Errata" and "Sync Errata" mailing.
2) Created product + repository 
3) Sync repository in Content Sync Status

Repository Sync ok and 4 erratas added.

Expected:

Mail notification

Result:

No mail notification and error showed on foreman/production.log.

2017-02-21 15:04:24 [app] [E] Unable to send errata e-mail notification: undefined method `deliver_now' for #<MailNotification:0x0000000b26a498>

foreman-debug attached.

Comment 18 Brad Buckingham 2017-02-21 21:07:08 UTC
The failure looks to be due to rails 4.2 (upstream) vs 4.1 (downstream).  In the upstream, the mail notifications have been updated to support the 'deliver_now' method; however, that doesn't exist in 4.1.

I'll submit an MR shortly with the change.

Comment 21 Bruno Rocha 2017-03-02 18:21:54 UTC
Created attachment 1259246 [details]
Email received

Comment 22 Bruno Rocha 2017-03-02 18:23:21 UTC
Verified in:

 satellite-6.2.8-4.0.el7sat.noarch


Result:

  Sync Summary email received! (attached screenshot)

Comment 24 errata-xmlrpc 2017-03-06 08:27:52 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2017:0447


Note You need to log in before you can comment on or make changes to this bug.