[Yum-devel] [PATCH 01/10] MirrorGroup: add failed mirrors' exceptions.

Zdenek Pavlas zpavlas at redhat.com
Thu Sep 15 15:46:42 UTC 2011


> What's the "if 0" for?

It's just a (disabled) example how to make use of the new attributes.
May or may not go there as well, not sure.

> Apart from that, it looks fine.

Hmm, I just realized that MirrorGroup class supports failure_callback
that receives equally detailed information as well, and that gets
called for every failed mirror.

Yum never used that for anything useful- there's a per-repo attribute
'mirror_failure_obj'.  It's initialized to None and and never updated 
(as function setMirrorFailureCallback is defined but never used).
Using that callback to collect exceptions from mirror attempts should
not break anything..

So maybe this patch is redundant, and pointing the callback
to something that collects exception objects is better...

e.g.

errors = []
try: self.grab.urlgrab(.. failure_callback=errors.append)
except URLGrabError:
  # Must be 'No more mirrors'
  for i in errors:
    print 'url', i.url, 'exc', i.exception ...

Zdenek


More information about the Yum-devel mailing list