Bug 732951

Summary: errata mailer doesn't detect and list correct number and list of affected systems
Product: Red Hat Satellite 5 Reporter: Tomas Lestach <tlestach>
Component: ServerAssignee: Tomas Lestach <tlestach>
Status: CLOSED DUPLICATE QA Contact: Red Hat Satellite QA List <satqe-list>
Severity: medium Docs Contact:
Priority: medium    
Version: 540CC: cperry
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-10-20 19:59:33 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:
Bug Depends On:    
Bug Blocks: 677498    
Attachments:
Description Flags
Text file with lots of SQL text and results none

Description Tomas Lestach 2011-08-24 09:27:12 UTC
Description of problem:
Some of the systems are listed several times in the Errata Alert Emails.

Version-Release number of selected component (if applicable):
sat541, spacewalk-java-1.2.39-91.el5sat

Steps to Reproduce:
1. Sync a relevant erratum and check:
* /var/log/rhn/rhn_taskomatic_daemon.log
* Errata Alert e-mails sent to appropriate satellite admins
  
Actual results:
a.)
From rhn_taskomatic.log:
INFO   | jvm 2    | 2011/08/23 11:30:02 | 2011-08-23 11:30:02,670 [DefaultQuartzScheduler_Worker-9] INFO com.redhat.rhn.taskomatic.task.ErrataMailer - Found 54 systems for erratum 2726 in channel 101 for org1. 
But only 11 systems are registered to the satellite.

b.)
Some of the systems are listed several times in the Errata Alert e-mails.
---------------------
Affected Systems List
---------------------
This Errata Advisory may apply to the systems listed below. If you know that
this errata does not apply to a system listed, it might be possible that the
package profile for that server is out of date. In that case you should run
'up2date -p' (RHEL 4 and below) or 'rhn-profile-sync' (RHEL 5 and above) as root on the system in question to refresh your software profile.



There are 27 affected systems registered in 'Overview' (only systems for
which you have explicitly enabled Errata Alerts are shown).

Release    Arch       Profile Name
---------- ---------- ---------------------------------------------
5Server    i686       rlx-2-14.rhndev.redhat.com (3x)
5Server    i686       rlx-3-04.rhndev.redhat.com (6x)
5Server    i686       xen17.englab.brq.redhat.com
5Server    i686       xen17.englab.brq.redhat.com
5Server    i686       xen17.englab.brq.redhat.com
5Server    i686       rlx-0-24.rhndev.redhat.com (3x)
5Server    i686       rlx-1-18.rhndev.redhat.com (12x)

Appropriate WebUI page

https://<satellite>/rhn/errata/details/SystemsAffected.do?eid=2726
lists 8 systems only (some of the system profiles are duplicated).

Expected results:
Correct number of relevant systems detected and complete list of relevant systems without any duplicates

Comment 1 Clifford Perry 2011-08-24 13:41:25 UTC
Created attachment 519642 [details]
Text file with lots of SQL text and results

Attaching my own quick review. 

IT seems highly likely (with a slow down) that using DISTINCT with the SQL will pass to the Errata mailer a correct list of systems effected per org, per user for each errata.

Comment 2 Clifford Perry 2011-08-24 13:45:51 UTC
Within java/code/src/com/redhat/rhn/taskomatic/task/ErrataMailer.java it seems that the getUserServers will correctly list servers for each user. So likely this distinct would indeed pass correct data to the java layer, before mailing out. 

We could also distinct the data in java stack - vs assuming we get correct unique data from query. 

Cliff

Comment 3 Clifford Perry 2011-08-24 13:51:43 UTC
The distinct reduced from 48 (8x6) results, to 16 (2x8). Since there is two users, 16 results actually is the correct looking data set to return.

Comment 4 Clifford Perry 2011-10-20 19:59:33 UTC

*** This bug has been marked as a duplicate of bug 640535 ***