Bug 733165 - reposync of rhn repositories ignores repoid specified
Summary: reposync of rhn repositories ignores repoid specified
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
Target Milestone: rc
: ---
Assignee: James Antill
QA Contact: Red Hat Satellite QA List
Depends On:
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:
Last Closed: 2011-08-25 15:04:53 UTC
Target Upstream Version:

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):


How reproducible:

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:

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):

        if thisrepo is None:
            repos = self.listEnabled()
            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.doRepoSetup()  ### New position of this call

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

    # --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"

    # Use progress bar display when downloading repo metadata
    # and package files
    if not opts.quiet:


        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.