Project

General

Profile

Actions

Bug #8795

closed

Email notifications can clutter the log

Added by Shimon Shtein over 9 years ago. Updated about 9 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
-
Category:
E-Mail
Target version:
-
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

Use case:
1. Set frequency of mail notification to "daily" in user settings (User -> MyAccount -> Mail preferences)
2. Unset the option "Mail enabled"
3. Run "rake reports:daily"

Expected: nothing happens
Actual: Exception in the logs


Related issues 2 (0 open2 closed)

Is duplicate of Foreman - Bug #9795: Notification should never be sent if user has mail enabledClosedStephen Benjamin03/17/2015Actions
Is duplicate of Foreman - Bug #9873: Failed report notifications for hosts owned by group only go to last user listed in group.ClosedDominic Cleal03/23/2015Actions
Actions #1

Updated by Dominic Cleal over 9 years ago

  • Category set to E-Mail

Can you provide a bit more info - what exception and logging are you seeing?

Note that some backtraces are printed at debug level, but wouldn't usually in production with info/warning logging only.

Actions #2

Updated by Shimon Shtein over 9 years ago

I'm talking about the exception that is thrown from our mailers, for example:

app/mailers/host_mailer.rb

In the first line of #summary you can see this line:
raise ::Foreman::Exception.new(N_("Must specify a user with email enabled")) unless (user=User.find(options[:user])) && user.mail_enabled?

It's an exception, so it will be risen as a warning (will be shown in production).
As far as I looked in the code of the rake task mechanism, there is no filtering of mailers based on #mail_enabled field. The only filtering is based on frequency, so if the frequency was once set, the code shown above would run, and if the #mail_enabled property is unset - it will raise an exception.

Actions #3

Updated by Ohad Levy over 9 years ago

I can confirm, i see in my production logs:

Failed to send email notification puppet_error_state: ERF42-5670 [Foreman::Exception]: unable to find recipients

since this is repeating per client with errors, it might be occurring in the logs too often, but I'm not sure if we should remove it?

Actions #4

Updated by Dominic Cleal about 9 years ago

  • Is duplicate of Bug #9795: Notification should never be sent if user has mail enabled added
Actions #5

Updated by Dominic Cleal about 9 years ago

  • Status changed from New to Resolved

I believe #9795 has fixed this by putting a fast return inside the UserMailNotification.

Actions #6

Updated by Dominic Cleal about 9 years ago

Ohad Levy wrote:

I can confirm, i see in my production logs:

Failed to send email notification puppet_error_state: ERF42-5670 [Foreman::Exception]: unable to find recipients

Oh, and this is a slightly different condition (it's an alert, not a summary), but #9873 will fix that in the way it refactors alerting to groups.

Actions #7

Updated by Dominic Cleal about 9 years ago

  • Is duplicate of Bug #9873: Failed report notifications for hosts owned by group only go to last user listed in group. added
Actions

Also available in: Atom PDF