Bug 1407163 - Raise exceptions with HTTP error info. r=glandium, a=test-only
authorDustin J. Mitchell <dustin@mozilla.com>
Fri, 12 Jan 2018 17:19:58 +0000
changeset 445683 9942e1807fd52a46db5c56c4c81ec607f10423bf
parent 445682 20e64779a662217b6d43df9d60ec120ceadc977d
child 445684 987fba771fbf2640f34f760118b2cbc285416fc3
push id1629
push userryanvm@gmail.com
push dateThu, 18 Jan 2018 14:27:59 +0000
treeherdermozilla-release@ff6f39465890 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersglandium, test-only
bugs1407163
milestone58.0
Bug 1407163 - Raise exceptions with HTTP error info. r=glandium, a=test-only MozReview-Commit-ID: B3MvsZDpj9a
python/mozbuild/mozbuild/mach_commands.py
--- a/python/mozbuild/mozbuild/mach_commands.py
+++ b/python/mozbuild/mozbuild/mach_commands.py
@@ -1314,29 +1314,29 @@ class PackageFrontend(MachCommandBase):
                 if self.size is None and self.digest is None:
                     return True
                 return super(DownloadRecord, self).validate()
 
         class ArtifactRecord(DownloadRecord):
             def __init__(self, task_id, artifact_name):
                 cot = cache._download_manager.session.get(
                     get_artifact_url(task_id, 'public/chainOfTrust.json.asc'))
+                cot.raise_for_status()
                 digest = algorithm = None
-                if cot.status_code == 200:
-                    # The file is GPG-signed, but we don't care about validating
-                    # that. Instead of parsing the PGP signature, we just take
-                    # the one line we're interested in, which starts with a `{`.
-                    data = {}
-                    for l in cot.content.splitlines():
-                        if l.startswith('{'):
-                            try:
-                                data = json.loads(l)
-                                break
-                            except Exception:
-                                pass
+                data = {}
+                # The file is GPG-signed, but we don't care about validating
+                # that. Instead of parsing the PGP signature, we just take
+                # the one line we're interested in, which starts with a `{`.
+                for l in cot.content.splitlines():
+                    if l.startswith('{'):
+                        try:
+                            data = json.loads(l)
+                            break
+                        except Exception:
+                            pass
                 for algorithm, digest in (data.get('artifacts', {})
                                               .get(artifact_name, {}).items()):
                     pass
 
                 name = os.path.basename(artifact_name)
                 artifact_url = get_artifact_url(task_id, artifact_name,
                     use_proxy=not artifact_name.startswith('public/'))
                 super(ArtifactRecord, self).__init__(