Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 1369817 - Email notification fails for Satellite Promotion and Satellite Sync Summary
Email notification fails for Satellite Promotion and Satellite Sync Summary
Status: CLOSED ERRATA
Product: Red Hat Satellite 6
Classification: Red Hat
Component: Email (Show other bugs)
6.2.0
x86_64 Linux
high Severity medium (vote)
: 6.2.8
: Unused
Assigned To: Justin Sherrill
Bruno Rocha
: PrioBumpGSS, Regression, Triaged
Depends On:
Blocks: 1122832 CEE_Sat6_Top_BZs/GSS_Sat6_Top_Bugs 1417069
  Show dependency treegraph
 
Reported: 2016-08-24 09:23 EDT by anerurka
Modified: 2017-03-25 01:08 EDT (History)
16 users (show)

See Also:
Fixed In Version: rubygem-katello-3.0.0.105-1
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1417069 (view as bug list)
Environment:
Last Closed: 2017-03-06 03:27:52 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


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


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Knowledge Base (Solution) 2575831 None None None 2016-09-16 18:38 EDT
Foreman Issue Tracker 16303 None None None 2016-08-26 12:27 EDT
Red Hat Product Errata RHBA-2017:0447 normal SHIPPED_LIVE Satellite 6.2.8 Async Bug Release 2017-03-06 08:23:41 EST

  None (edit)
Description anerurka 2016-08-24 09:23:55 EDT
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 14:23:30 EDT
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 15:44:57 EDT
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 15:59 EDT
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 16:00:29 EDT
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 06:34:03 EST
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 07:57:17 EST
@peter++

Moving to POST :)
Comment 15 Og Maciel 2017-02-21 15:08:45 EST
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 15:42 EST
Created attachment 1256244 [details]
foreman-debug-6.2.8-3.0
Comment 17 Bruno Rocha 2017-02-21 15:51:50 EST
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 16:07:08 EST
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 13:21 EST
Created attachment 1259246 [details]
Email received
Comment 22 Bruno Rocha 2017-03-02 13:23:21 EST
Verified in:

 satellite-6.2.8-4.0.el7sat.noarch


Result:

  Sync Summary email received! (attached screenshot)
Comment 24 errata-xmlrpc 2017-03-06 03:27:52 EST
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.