Bug 1428219 - Sync Errata should send emails only if Errata count is greater than 0
Summary: Sync Errata should send emails only if Errata count is greater than 0
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Errata Management
Version: 6.2.0
Hardware: x86_64
OS: Linux
medium
medium vote
Target Milestone: Unspecified
Assignee: Kavita
QA Contact: Walden Raines
URL: http://projects.theforeman.org/issues...
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-03-02 03:36 UTC by Renu Chauhan
Modified: 2020-08-13 08:54 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-02-21 16:51:07 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 18784 0 None None None 2017-03-03 09:27:57 UTC

Description Renu Chauhan 2017-03-02 03:36:29 UTC
Description of problem:Do not send "sync errata" email when there are no sync errata updates after repository synchronization.The mail for  syncing an errata should only be sent when actual errata updates are available or they are greater than zero. If a daily sync is applied then a mail is sent even if there are no errata updates avilable. 


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

How reproducible:
Always

Steps to Reproduce:
1.users = User.where(:mail => 'abc@redhat.com')  #<-- Create account add valid email and change email here
User.current = users.first
repo = Katello::Repository.find(383)   #<--- id of "Red Hat Enterprise Linux 7 Server RPMs x86_64 7Server"
last_updated = repo.repository_errata.order('updated_at ASC').last.try(:updated_at)
if last_updated
 errata = Katello::Erratum.where(:id => repo.repository_errata.where('katello_repository_errata.updated_at > ?', last_updated.to_datetime).pluck(:erratum_id))
 puts errata.size
 MailNotification[:sync_errata].deliver(:users => users, :repo => repo, :errata => errata)
end
~~

If there is a daily sync schedule then its annoying to receive daily mail with 0 errata 


Actual results:
A mail is received stating for errata update with 0 errata 

Expected results:
A mail for errata updates should only be triggered if the errata count is more than zero.

Additional info:

Comment 1 Satellite Program 2017-03-03 11:19:51 UTC
Upstream bug assigned to kgaikwad@redhat.com

Comment 3 Satellite Program 2017-03-17 18:19:16 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue http://projects.theforeman.org/issues/18784 has been resolved.

Comment 5 Walden Raines 2017-08-02 18:35:34 UTC
Verified in 6.3.0 snap 9.

Comment 6 Satellite Program 2018-02-21 16:51:07 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


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