Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 585901

Summary: Java repodata generator does not recurse for comps file
Product: Red Hat Satellite 5 Reporter: Jan Pazdziora (Red Hat) <jpazdziora>
Component: ServerAssignee: Tomas Lestach <tlestach>
Status: CLOSED ERRATA QA Contact: Pavel Kralik <pkralik>
Severity: medium Docs Contact:
Priority: urgent    
Version: 530CC: cperry, mvecera, pkralik, tao, tlestach, xdmoon
Target Milestone: ---Keywords: Regression
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-05-27 07:04:52 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: 518256    

Description Jan Pazdziora (Red Hat) 2010-04-26 11:28:03 UTC
Description of problem:

When we wrote the original comps-serving code for cloned channels (bug 457478 and bug 452046), we recursed through all the cloned-from channels, not just did look at the immediate predecesor.

When the code was rewritted to Java, this was lost.

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

Satellite 5.3.x.

How reproducible:

Looking at code. Also, reports by users.

Steps to Reproduce:
1. Have Satellite and client system with RHEL 5 registered to it. Have the RHEL 5 channel synced.
2. Verify that the client can do yum clan all ; yum grouplist Core > /dev/null without error and check that /var/cache/yum/rhel-i386-server-5/repomd.xml contains group data that point to comps file, and that the comps file was retrieved as well.
3. Clone channel from that RHEL 5 channel and change the base channel to this new cloned one.
4. Repeat step 2 and verify that it still works.
5. Clone channel from that cloned channel and change the base channel to this new cloned one.
5. Repease step 2.
  
Actual results:

It fails, if you have Java repodata generator (the default).

It passes if you use Python.

Expected results:

It should work in all cases.

Additional info:

The problem is that while we have

    def get_comps_file(self):
        """ Return a file-like object of the comps.xml for the channel. """
        if self.channel.comps:
            comps_view = view.CompsView(self.channel.comps)
            return comps_view.get_file()
        elif comps_mapping.has_key(self.channel.label):
            comps_view = view.CompsView(Comps(None, 
                os.path.join(CFG.mount_point, comps_mapping[self.channel.label])))
            return comps_view.get_file()
        else:
            if self.channel.cloned_from_id is not None:
                log_debug(1, "No comps and no comps_mapping for [%s] cloned from [%s] trying to get comps from the original one." \
                          % ( self.channel.id, self.channel.cloned_from_id ))
                cloned_from_channel = rhnChannel.Channel().load_by_id(self.channel.cloned_from_id)
                cloned_from_channel_label = cloned_from_channel._row['label']
                return Repository(rhnChannel.channel_info(cloned_from_channel_label)).get_comps_file()
        return None

in Python's Repository class, so we effectively recurse, in Java, this was only written as

        if (compsMapping.containsKey(channel.getLabel())) {
            compsPath = compsMapping.get(channel.getLabel());
        }
        else if (channel.isCloned()) {
            // If its a cloned channel see if we can get the comps
            // from the original channel.
            ClonedChannel clonedCh = (ClonedChannel) channel;
            Channel origChannel = clonedCh.getOriginal();
            compsPath = compsMapping.get(origChannel.getLabel());
        }

        return compsPath;

No recursion here.

If would also like to point out that in Python, by default we get the comps information from the database from that cloned-from channel, not just the static mapping.

Comment 2 Tomas Lestach 2010-05-05 15:25:47 UTC
Recursion implemented for comps search.

spacewalk.git: 5b0da627a2788330dfd60ef04b072b4dea416d05

Comment 3 Tomas Lestach 2010-05-06 07:57:08 UTC
one more commit

spacewalk.git: 4145a5cdbaac43ebda4b4600af3dacf0a003a9c9

Comment 9 errata-xmlrpc 2010-05-27 07:04:52 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2010-0443.html