Bug 1385621 - Fix `mach artifact toolchain` handling of download exceptions after bug 1364650. r?gps draft
authorMike Hommey <mh+mozilla@glandium.org>
Fri, 18 Aug 2017 09:31:35 +0900
changeset 648590 19be49fbe537be7e47285587bd5acecf9ae0ffed
parent 647817 63ca686c3f1e870649b6d9c559973d100573aec2
child 726867 d3dad62184d4dbafbebc12c422229986eafa79c9
push id74804
push userbmo:mh+mozilla@glandium.org
push dateFri, 18 Aug 2017 00:32:12 +0000
reviewersgps
bugs1385621, 1364650
milestone57.0a1
Bug 1385621 - Fix `mach artifact toolchain` handling of download exceptions after bug 1364650. r?gps
python/mozbuild/mozbuild/mach_commands.py
--- a/python/mozbuild/mozbuild/mach_commands.py
+++ b/python/mozbuild/mozbuild/mach_commands.py
@@ -1929,24 +1929,24 @@ class PackageFrontend(MachCommandBase):
             for attempt, _ in enumerate(redo.retrier(attempts=retry+1,
                                                      sleeptime=60)):
                 try:
                     record.fetch_with(cache)
                 except (requests.exceptions.HTTPError,
                         requests.exceptions.ChunkedEncodingError,
                         requests.exceptions.ConnectionError) as e:
 
-                    if isinstance(e, requests.exceptions.ConnectionError):
-                        should_retry = True
-                    else:
+                    if isinstance(e, requests.exceptions.HTTPError):
                         # The relengapi proxy likes to return error 400 bad request
                         # which seems improbably to be due to our (simple) GET
                         # being borked.
                         status = e.response.status_code
                         should_retry = status >= 500 or status == 400
+                    else:
+                        should_retry = True
 
                     if should_retry or attempt < retry:
                         level = logging.WARN
                     else:
                         level = logging.ERROR
                     # e.message is not always a string, so convert it first.
                     self.log(level, 'artifact', {}, str(e.message))
                     if not should_retry: