Bug 1281302

Summary: empty packages comparison when comparing channel cloned in "original state" (i.e. no erratas) to its origin
Product: Red Hat Satellite 5 Reporter: Jan Hutař <jhutar>
Component: WebUIAssignee: Grant Gainey <ggainey>
Status: CLOSED DEFERRED QA Contact: Red Hat Satellite QA List <satqe-list>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 570CC: dyordano, tlestach
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: 2018-04-09 14:51:50 UTC Type: Bug
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: 1309768    

Description Jan Hutař 2015-11-12 09:33:49 UTC
Description of problem:
There is empty packages comparison list when comparing channel cloned in "original state" (i.e. no erratas) to its origin


Version-Release number of selected component (if applicable):
spacewalk-java-2.3.8-117.el6sat.noarch


How reproducible:
always


Steps to Reproduce:
1. Create new channel "channel":
   Channels -> Manage Software Channels -> Create Channel
2. Add one package to the channel:
   Channels -> Manage Software Channels -> channel -> Packages -> Add
   (I have used "Django14-1.4.21-1.el6.noarch")
3. a) Add one errata with another package:
      Channels -> Manage Software Channels -> channel -> Errata -> Add ->
      -> Create Custom Errata
      (I have created errata "errata")
   b) Add package to the errata:
      While on errata detail page (right after it is created) -> Packages -> Add
      (I have used "Django-south-0.7.5-1.el6-noarch")
   c) Publish errata "errata" to channel "channel", package as well
      While on errata detail page -> [Publish Errata] -> check "channel" ->
      -> [Publish Errata] -> check package -> [Continue]
4. Ensure you have correct packages and erratas in the channel:
   Channels -> Manage Software Channels -> channel -> Packages -> List / Remove
     (should list two packages: Django14 and Django-south in my case)
   Channels -> Manage Software Channels -> channel -> Errata -> List / Remove
     (should list one errata "errata")
5. Clone that channel without erratas:
   Channels -> Manage Software Channels -> Clone Channel
     Clone From: channel
     Clone: Original state of the channel (no errata)
6. Check packages and erratas which are part of the cloned channel:
   Channels -> Manage Software Channels -> Clone of channel -> Packages ->
   -> List / Remove
     (should list only one package: Django14 in my case)
   Channels -> Manage Software Channels -> Clone of channel -> Errata ->
   -> List / Remove
     (should say: There are no errata associated with this channel.)
7. Compare packages of cloned channel to its origin:
   Channels -> Manage Software Channels -> Clone of channel -> Packages ->
   -> Compare
     Compare to: "channel" -> [View Packages]


Actual results:
Empty list saying "No packages found for this critera."


Expected results:
IMO Django-south should be shown as missing in cloned channel in my case


Additional info:
I believe this is a query counting the difference:

select  pn.name as package_name,
       pa.name as arch,
       ch1.package_id as left_id,
       case when ch1.evr is null then null
           else evr_t_as_vre_simple(ch1.evr)
       end as left_nvrea,
       ch2.package_id as right_id,
       case when ch2.evr is null then null
           else evr_t_as_vre_simple(ch2.evr)
       end as right_nvrea,
       case when ch1.evr_id is null then -2
            when ch2.evr_id is null then 2
            else rpm.vercmp(ch1.epoch, ch1.version, ch1.release,
                            ch2.epoch, ch2.version, ch2.release)
       end as comparison
 from (select np1.name_id, np1.package_arch_id, np1.evr_id, np1.package_id,
               pe1.evr, pe1.epoch, pe1.version, pe1.release
         from rhnChannelNewestPackage np1
         join rhnPackageEvr pe1
           on pe1.id = np1.evr_id
       where channel_id = 116
       ) ch1
 full outer join (select np2.name_id, np2.package_arch_id, np2.evr_id, np2.package_id,
                       pe2.evr, pe2.epoch, pe2.version, pe2.release
                    from rhnChannelNewestPackage np2
                    join rhnPackageEvr pe2
                      on pe2.id = np2.evr_id
                   where channel_id = 127
       ) ch2
   on ch1.name_id = ch2.name_id
  and ch1.package_arch_id = ch2.package_arch_id
 join rhnPackageName pn
   on pn.id = coalesce(ch1.name_id, ch2.name_id)
 join rhnPackageArch pa
   on pa.id = coalesce(ch1.package_arch_id, ch2.package_arch_id)
where ch1.evr_id is null
   or ch2.evr_id is null
   or ch1.evr_id != ch2.evr_id

In my case "channel" have cid 135 and "Clone of channel" have 136.

rhnschema=# select count(*) from rhnChannelPackage where channel_id = 135;
 count 
-------
     2
(1 row)

rhnschema=# select count(*) from rhnChannelPackage where channel_id = 136;
 count 
-------
     1
(1 row)

rhnschema=# select count(*) from rhnChannelNewestPackage where channel_id = 135;
 count 
-------
     2
(1 row)

rhnschema=# select count(*) from rhnChannelNewestPackage where channel_id = 136;
 count 
-------
     2
(1 row)
rhnschema=# select * from rhnChannelPackage where channel_id = 136;
 channel_id | package_id |            created            |           modified            
------------+------------+-------------------------------+-------------------------------
        136 |      17937 | 2015-11-12 09:39:33.672644+01 | 2015-11-12 09:39:33.672644+01
(1 row)

rhnschema=# select * from rhnChannelNewestPackage where channel_id = 136;
 channel_id | name_id | evr_id | package_arch_id | package_id 
------------+---------+--------+-----------------+------------
        136 |    4923 |   6996 |             100 |      17937
        136 |    5541 |   7053 |             100 |      18607
(2 rows)

Comment 1 Jan Hutař 2015-11-12 09:36:19 UTC
I have initially noticed this on child channel filled with EPEL x86_64 6 repo (with filter set to "+p*" to limit package count), but comment #0 is smaller setup which IMO makes it easier to see the issue.

Comment 2 Tomas Lestach 2018-04-09 14:51:50 UTC
We have re-reviewed this bug, as part of an ongoing effort to improve Satellite/Proxy feature and bug updates, review and backlog.

This is a low priority bug and has no currently open customer cases. While this bug may still valid, we do not see it being implemented prior to the EOL of the Satellite 5.x product. As such, this is being CLOSED DEFERRED. 

Closing now to help set customer expectations as early as possible. You are welcome to re-open this bug if needed.