Commit f9cc91d9 authored by hinoka@google.com's avatar hinoka@google.com

Change download_from_google_storage.py to not run gsutil config when receiving a 403

When a developer runs download_from_google_storage, and they don't have a .boto
file, the tool automatically runs "gsutil config" to create one for them.
Unfortunately, a side consequence is that if a bot runs the script, and it has
a boto file that 403's, then it would run "gsutil config" which moves the .boto
to .boto.bak, and creates an empty .boto file.  This should not be the intended
action.

This CL changes so that "gsutil config" is not called, but instead just fails
with a message telling the dev to run that command.

TBR=maruel@chromium.org

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@203824 0039d316-1c4b-4281-b951-d872f2087c98
parent 17f52827
......@@ -81,9 +81,8 @@ def check_bucket_permissions(bucket, gsutil):
code, _, ls_err = gsutil.check_call('ls', base_url)
if code == 403:
code, _, _ = gsutil.call('config')
if code != 0:
print >> sys.stderr, 'Error while authenticating to %s.' % base_url
print >> sys.stderr, 'Got error 403 while authenticating to %s.' % base_url
print >> sys.stderr, 'Try running "gsutil config".'
elif code == 404:
print >> sys.stderr, '%s not found.' % base_url
elif code != 0:
......
......@@ -82,7 +82,7 @@ class GstoolsUnitTests(unittest.TestCase):
self.assertEqual(err_lines[0], 'gsutil version 3.25')
self.assertEqual(
err_lines[1],
'checksum ce71ac982f1148315e7fa65cff2f83e8 (OK)')
'checksum 010822c61d38d70ac23600bc955fccf5 (OK)')
def test_get_sha1(self):
lorem_ipsum = os.path.join(self.base_path, 'lorem_ipsum.txt')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment