[download_from_google_storage] Don't list ALL objects to check for ACLs

Currently check_bucket_permissions() in download_from_google_storage.py
performs a gsutil ls gs://bucket to determine whether the user has access
to the bucket or not.
This can be an EXTREMELY expensive operation (~minutes) if the bucket in
question has a lot of objects in the root (real case: chrome-telemetry).
It is worth noting that check_bucket_permissions() is not called just for
uploads but also for downloads, hence this is slowing down all invocations
of gclient sync on users and bots machine.
Removing the check_bucket_permissions() and let gsutil fail with an
Unauthorized error message if ACLs are not met.

BUG=458059

Review URL: https://codereview.chromium.org/923473002

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@294083 0039d316-1c4b-4281-b951-d872f2087c98
This commit is contained in:
primiano@chromium.org
2015-02-17 12:33:35 +00:00
parent 1c1273893e
commit e48b81e62b
2 changed files with 0 additions and 24 deletions

View File

@@ -15,7 +15,6 @@ import sys
import threading
import time
from download_from_google_storage import check_bucket_permissions
from download_from_google_storage import get_sha1
from download_from_google_storage import Gsutil
from download_from_google_storage import printer_worker
@@ -243,11 +242,6 @@ def main(args):
base_url = 'gs://%s' % options.bucket
# Check we have a valid bucket with valid permissions.
code = check_bucket_permissions(base_url, gsutil)
if code:
return code
return upload_to_google_storage(
input_filenames, base_url, gsutil, options.force, options.use_md5,
options.num_threads, options.skip_hashing)