Bug 1306189 - Add proper signature + better logging + stop trying to upload the corrupted file. r=dustin

MozReview-Commit-ID: EBsIFuXN3E7

--HG--
extra : rebase_source : 827be8246ca53008bd1de4afc08a3e1b9e0bc2b1
This commit is contained in:
Armen Zambrano Gasparnian 2016-09-29 11:08:27 -04:00
parent 27658c5d4c
commit 4376c75ee1

View File

@ -393,9 +393,9 @@ class ScriptMixin(PlatformMixin):
expected_file_size = int(response.headers.get('Content-Length'))
self.info('Http code: {}'.format(response.getcode()))
for k in ('Content-Encoding', 'Content-Type', 'via', 'x-amz-cf-id',
'x-amz-version-id', 'x-cache'):
self.info('{}: {}'.format(k, response.headers.get(k)))
for k in sorted(response.headers.keys()):
if k.lower().startswith('x-amz-') or k in ('Content-Encoding', 'Content-Type', 'via'):
self.info('{}: {}'.format(k, response.headers.get(k)))
file_contents = response.read()
obtained_file_size = len(file_contents)
@ -687,15 +687,9 @@ class ScriptMixin(PlatformMixin):
try:
function(**kwargs)
except zipfile.BadZipfile:
# Bug 1305752 - Sometimes a good download turns out to be a
# corrupted zipfile. Let's upload the file for inspection
filepath = os.path.join(self.query_abs_dirs()['abs_upload_dir'], url.split('/')[-1])
self.info('Storing corrupted file to {}'.format(filepath))
with open(filepath, 'w') as f:
f.write(compressed_file.read())
# Dump the exception and exit
self.exception(level=FATAL)
# Bug 1306189 - Sometimes a good download turns out to be a
# corrupted zipfile. Let's create a signature that is easy to match
self.fatal('Check bug 1306189 for details on downloading a truncated zip file.')
def load_json_url(self, url, error_level=None, *args, **kwargs):