Simply download_from_google_storage --config
This does two noticable things:
* Prints a message when "download_from_google_storage --config" is run to
tell the user to enter "0" for the project ID prompt
* Removes the ".boto.depot_tools" boto file and defaults the boto file to
grant fullcontrol scopes.
Context: We restricted the depot_tools specific scopes to be readonly out of
concern that we would be forcing every developer to hold a set of non-expiring
write access credentials on their workstation. But this distinction has caused
a great deal of pain and anguish with confusing credentials (who would've thought
~/.boto.depot_tools would exist and might be broken?), and not for huge security
gains. Most people don't have write access to buckets, and the ones that do
definitely has a fullcontrol boto file already.
BUG=
Review URL: https://codereview.chromium.org/1182583003
git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@295728 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/download_from_google_storage.py b/download_from_google_storage.py
index 291643b..a45f387 100755
--- a/download_from_google_storage.py
+++ b/download_from_google_storage.py
@@ -54,7 +54,7 @@
class Gsutil(object):
"""Call gsutil with some predefined settings. This is a convenience object,
and is also immutable."""
- def __init__(self, path, boto_path, timeout=None, version='4.7'):
+ def __init__(self, path, boto_path=None, timeout=None, version='4.7'):
if not os.path.exists(path):
raise FileNotFoundError('GSUtil not found in %s' % path)
self.path = path
@@ -70,11 +70,6 @@
elif self.boto_path:
env['AWS_CREDENTIAL_FILE'] = self.boto_path
env['BOTO_CONFIG'] = self.boto_path
- else:
- custompath = env.get('AWS_CREDENTIAL_FILE', '~/.boto') + '.depot_tools'
- custompath = os.path.expanduser(custompath)
- if os.path.exists(custompath):
- env['AWS_CREDENTIAL_FILE'] = custompath
return env
@@ -403,8 +398,11 @@
# Passing in -g/--config will run our copy of GSUtil, then quit.
if options.config:
- return gsutil.call('config', '-r', '-o',
- os.path.expanduser('~/.boto.depot_tools'))
+ print '===Note from depot_tools==='
+ print 'If you do not have a project ID, enter "0" when asked for one.'
+ print '===End note from depot_tools==='
+ print
+ return gsutil.call('config')
if not args:
parser.error('Missing target.')