Bug 1473909

Summary: Mail notifications not being sent
Product: Red Hat Satellite Reporter: Marek Hulan <mhulan>
Component: EmailAssignee: Marek Hulan <mhulan>
Status: CLOSED ERRATA QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 6.3.0CC: bbuckingham, dlobatog
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: foreman-1.15.2 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-02-21 16:49:54 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Marek Hulan 2017-07-22 09:53:05 UTC
rake reports:daily task fails with following trace

<pre>
rake aborted!
NoMethodError: undefined method `mail_enabled?' for nil:NilClass
/home/ares/Projekty/Zdrojaky/foreman/app/models/user_mail_notification.rb:10:in `deliver'
/home/ares/Projekty/Zdrojaky/foreman/lib/tasks/reports.rake:97:in `block in process_notifications'
/home/ares/Projekty/Zdrojaky/foreman/lib/tasks/reports.rake:96:in `process_notifications'
/home/ares/Projekty/Zdrojaky/foreman/lib/tasks/reports.rake:102:in `block (2 levels) in <top (required)>'
/home/ares/.rbenv/versions/2.2.2/bin/bundle:23:in `load'
/home/ares/.rbenv/versions/2.2.2/bin/bundle:23:in `<main>'
Tasks: TOP => reports:daily
(See full trace by running task with --trace)
</pre>

it's obviously caused by taxonomies, the rake task is not running under admin user so mail notification user can not be found if the user is in any context. I think that's a candidate for 1.15.z since it's a regression caused by #16982

Comment 1 Marek Hulan 2017-07-22 09:53:09 UTC
Created from redmine issue http://projects.theforeman.org/issues/20017

Comment 2 Marek Hulan 2017-07-22 09:53:15 UTC
Upstream bug assigned to mhulan

Comment 5 Daniel Lobato Garcia 2017-08-02 11:17:24 UTC
Verified.

Version tested:

foreman-1.15.2-1.el7sat.noarch
satellite-6.3.0-16.0.beta.el7sat.noarch

Running foreman-rake reports:daily does not return any error anymore.

Comment 6 Satellite Program 2018-02-21 16:49:54 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/RHSA-2018:0336