[Yum-devel] [PATCH] yum/yumRepo does not uses URLGrabber provided by yum extension
zpavlas at redhat.com
Thu Sep 8 07:31:36 UTC 2011
> + def _createDefaultGrabber(**kwargs):
> + ug = self._getgrab()
You may as well use self.grab directly.
> + if ug == nil:
> + return URLGrabber(kwargs)
> + return ug
None instead of 'nil', perhaps?
But _getgrab() may never return that.
> def _getMetalink(self):
> + ug = _createDefaultGrabber(bandwidth = self.bandwidth,
Are you sure this does not trigger an infinite recursion?
_getMetalink() => _createDefaultGrabber() => _getgrab()
=> _setupGrab() => self.urls => _geturls() => _baseurlSetup()
=> self.metalink_data => _getMetalink()
grabber self.grab is mirrors-aware, so you can't use it
to fetch the mirror list itself. There's a self.grabfunc
that does not use mirror lists (and is one of the many
write-only attributes in yum), but _setupGrab() sets both
at the same time so can't use it either.
That's likely why getMetalink() instantiates it's own grabber.
What's the issue with that? Does the yum-s3 plugin replace
self._grab with a custom grabber? Does it so before
_getMetalink(), so it should use the one that's there already?
It seems likely, because otherwise it'd fail.
Then it'd probably make sense to do something like:
ug = self._grab
if not ug:
# no grabber yet, make our own
ugopts = self._default_grabopts()
ug = URLGrabber(..., **ugopts)
More information about the Yum-devel