Bug #20017

Mail notifications not being sent

Added by Marek Hulán 4 months ago. Updated 3 months ago.

Status:Closed
Priority:Normal
Assigned To:Marek Hulán
Category:E-Mail
Target version:-
Difficulty: Bugzilla link:1473909
Found in release:1.15.0 Pull request:https://github.com/theforeman/foreman/pull/4589
Story points-
Velocity based estimate-
Release1.15.2Release relationshipAuto

Description

rake reports:daily task fails with following trace

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)

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


Related issues

Related to Foreman - Bug #16982: CVE-2016-7078 - User with no organizations or locations c... Closed 10/18/2016
Related to Foreman - Tracker #10022: Taxonomies related issues New 04/05/2015

Associated revisions

Revision cd68b208
Added by Marek Hulán 4 months ago

Fixes #20017 - mail notifications work for global admins

Revision 00b0fa8b
Added by Marek Hulán 4 months ago

Fixes #20017 - mail notifications work for global admins

(cherry picked from commit cd68b2083022f7c50f45b73f64c3b991613448dd)

History

#1 Updated by Marek Hulán 4 months ago

  • Related to Bug #16982: CVE-2016-7078 - User with no organizations or locations can see all resources added

#2 Updated by Marek Hulán 4 months ago

#3 Updated by The Foreman Bot 4 months ago

  • Status changed from New to Ready For Testing
  • Assigned To set to Marek Hulán
  • Pull request https://github.com/theforeman/foreman/pull/4589 added

#4 Updated by Marek Hulán 4 months ago

  • Release set to 1.15.2

I propose this for 1.15.2, there's no github label yet so just setting here for now.

#5 Updated by Marek Hulán 4 months ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100

#6 Updated by Marek Hulán 3 months ago

  • Bugzilla link set to 1473909

Also available in: Atom PDF