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):
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)
reposync syncs all repos including:
reposync should only sync rhel-x86_64-workstation-6
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):
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)
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 ***
OK. Great. Thanks!