[Yum-devel] [PATCH] get retrycode *after* failure_callback has run
Zdeněk Pavlas
zpavlas at redhat.com
Wed Jun 27 14:50:07 UTC 2012
---
urlgrabber/grabber.py | 5 ++---
1 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/urlgrabber/grabber.py b/urlgrabber/grabber.py
index 3127b48..c46f96f 100644
--- a/urlgrabber/grabber.py
+++ b/urlgrabber/grabber.py
@@ -1011,7 +1011,6 @@ class URLGrabber(object):
# beware of infinite loops :)
tries = tries + 1
exception = None
- retrycode = None
callback = None
if DEBUG: DEBUG.info('attempt %i/%s: %s',
tries, opts.retry, args[0])
@@ -1022,7 +1021,6 @@ class URLGrabber(object):
except URLGrabError, e:
exception = e
callback = opts.failure_callback
- retrycode = e.errno
except KeyboardInterrupt, e:
exception = e
callback = opts.interrupt_callback
@@ -1040,6 +1038,7 @@ class URLGrabber(object):
if DEBUG: DEBUG.info('retries exceeded, re-raising')
raise
+ retrycode = getattr(exception, 'errno', None)
if (retrycode is not None) and (retrycode not in opts.retrycodes):
if DEBUG: DEBUG.info('retrycode (%i) not in list %s, re-raising',
retrycode, opts.retrycodes)
@@ -2176,7 +2175,7 @@ def parallel_wait(meter = 'text'):
try: _run_callback(opts.failure_callback, opts)
except URLGrabError, ug_err:
retry = 0 # no retries
- if opts.tries < retry and ug_err.args[0] in opts.retrycodes:
+ if opts.tries < retry and ug_err.errno in opts.retrycodes:
start(opts, opts.tries + 1) # simple retry
continue
--
1.7.4.4
More information about the Yum-devel
mailing list