Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(192)

Unified Diff: download_from_google_storage.py

Issue 1091373004: Report more detailed error from download_from_google_storage.py when gsutil fails. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: download_from_google_storage.py
diff --git a/download_from_google_storage.py b/download_from_google_storage.py
index 5c1df0324c4c12a749b9abc2977420dcfdc4ad30..291643b1ee429099a1a27dd60731fb1f0c9a1914 100755
--- a/download_from_google_storage.py
+++ b/download_from_google_storage.py
@@ -100,7 +100,7 @@ class Gsutil(object):
if ('You are attempting to access protected data with '
'no configured credentials.' in err):
return (403, out, err)
- if 'No such object' in err:
+ if 'matched no objects' in err:
return (404, out, err)
return (code, out, err)
@@ -206,11 +206,19 @@ def _downloader_worker_thread(thread_num, q, force, base_url,
continue
# Check if file exists.
file_url = '%s/%s' % (base_url, input_sha1_sum)
- if gsutil.check_call('ls', file_url)[0] != 0:
- out_q.put('%d> File %s for %s does not exist, skipping.' % (
- thread_num, file_url, output_filename))
- ret_codes.put((1, 'File %s for %s does not exist.' % (
- file_url, output_filename)))
+ (code, _, err) = gsutil.check_call('ls', file_url)
+ if code != 0:
+ if code == 404:
+ out_q.put('%d> File %s for %s does not exist, skipping.' % (
+ thread_num, file_url, output_filename))
+ ret_codes.put((1, 'File %s for %s does not exist.' % (
+ file_url, output_filename)))
+ else:
+ # Other error, probably auth related (bad ~/.boto, etc).
+ out_q.put('%d> Failed to fetch file %s for %s, skipping. [Err: %s]' % (
+ thread_num, file_url, output_filename, err))
+ ret_codes.put((1, 'Failed to fetch file %s for %s. [Err: %s]' % (
+ file_url, output_filename, err)))
continue
# Fetch the file.
out_q.put('%d> Downloading %s...' % (thread_num, output_filename))
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698