RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 733165 - reposync of rhn repositories ignores repoid specified
Summary: reposync of rhn repositories ignores repoid specified
Keywords:
Status: CLOSED DUPLICATE of bug 713108
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: yum-utils
Version: 6.1
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: rc
: ---
Assignee: James Antill
QA Contact: Red Hat Satellite QA List
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-08-25 00:27 UTC by Steven Seed
Modified: 2014-01-21 06:24 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-08-25 15:04:53 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Steven Seed 2011-08-25 00:27:16 UTC
Description of problem:

reposync on RHEL6 behaves differently from RHEL5 when it comes to syncing rhn repositories. It seems that the repoid specified as a command line flag is ignored (at least with respect to rhn repos). In other words if I specify a repoid of rhel-x86_64-workstation-6, the rhn plugin will override this choice and enalbe all repos the host is subscribed to on rhn. The result is reposync transfers all repos in rhn that the host has a subscription for.


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

yum-utils-1.1.30-6.el6.noarch
yum-rhn-plugin-0.9.1-26.el6_1.1.noarch

How reproducible:
Always

Steps to Reproduce:
1. register host with rhn (in this case RHEL Workstation 6)
2. run reposync command (/usr/bin/reposync -l -m -d -n -r rhel-x86_64-workstation-6 --download_path=/var/repo_mirror -a x86_64)
  
Actual results:
reposync syncs all repos including:
rhel-x86_64-workstation-6
rhel-x86_64-workstation-6-debuginfo
rhel-x86_64-workstation-optional-6
rhel-x86_64-workstation-optional-6-debuginfo
rhel-x86_64-workstation-supplementary-6
rhel-x86_64-workstation-supplementary-6-debuginfo
rhn-tools-rhel-x86_64-workstation-6

Expected results:
reposync should only sync rhel-x86_64-workstation-6


Additional info:

As far as I can tell this problem comes about in the reposync script (/usr/bin/reposyc) when it calls my.doRepoSetup (line 191) after it's gone and determined which repos to enable/disable (based on the repoid passed in). This call ultimately calls doSetup in repos.py (/usr/lib/python2.6/site-packages/yum/repos.py). The first line in this function is where the problem occurs because is calls 'prereposetup' in the rhnplugin:


    def doSetup(self, thisrepo = None):
        
        self.ayum.plugins.run('prereposetup')

        if thisrepo is None:
            repos = self.listEnabled()
        else:
            repos = self.findRepos(thisrepo)
        ...
In the above snippet, the prereposetup that is executed in the rhnplugin overwrites the enalbed rhn repos in the repo object with all the rhn repos currently subscribed. The result of self.listEnalbed() is changed after this point.


A workaround I've put in place, though I'm not sure of the fallout is to move the call to 'my.doRepoSetup()' in reposync before the section that enables/disables the repos. This way, it properly disables the repos after the rhnplugin enables them. Here is the snippet (starting at line 162):
    ...
    elif opts.cachedir:
        my.repos.setCacheDir(opts.cachedir)

    my.doRepoSetup()  ### New position of this call

    if len(opts.repoid) > 0:
        myrepos = []
        
        # find the ones we want
        for glob in opts.repoid:
            myrepos.extend(my.repos.findRepos(glob))
        
        # disable them all
        for repo in my.repos.repos.values():
            repo.disable()
        
        # enable the ones we like
        for repo in myrepos:
            repo.enable()

    # --norepopath can only be sensibly used with a single repository:
    if len(my.repos.listEnabled()) > 1 and opts.norepopath:
        print >> sys.stderr, "Error: Can't use --norepopath with multiple repositories"
        sys.exit(1)

    # Use progress bar display when downloading repo metadata
    # and package files
    if not opts.quiet:
        my.repos.setProgressBar(TextMeter(fo=sys.stdout))

    my.doRpmDBSetup()

    try:
        arches = rpmUtils.arch.getArchList(opts.arch)
    ...

Comment 2 James Antill 2011-08-25 15:04:53 UTC
Yeh, it's already fixed for 6.2 ... basically the workaround you thought. I've also heard rumours that rhnplugin might be fixed as well.

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

Comment 3 Steven Seed 2011-08-25 18:50:08 UTC
OK. Great. Thanks!


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