-
Notifications
You must be signed in to change notification settings - Fork 330
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gsutil not using gcloug oauth details #376
Comments
The pip install and the gcloud install are separate from each other. If you are using the pip install, then
|
I had completely uninstalled gsutil via pip and deleted the .boto file before installing the standard sdk.
|
So does |
@thobrla ah! No, but you've helped me figure it out. Although this seems like a bug.
And that made me think about me ENV. I had BOTO_CONFIG defined in my bash_profile as
Which gave me
BUT....gsutil now works. It shows the same config path, same file however. Neither of which are .config/gcloud |
I do think there is bug here - when looking for the config path, we break when discovering the first valid file, but multiple files could be specified via the BOTO_PATH variable (which is how gcloud passes credentials to gsutil). |
I believe I'm running into this config file issue too. I want to set If I set
Note that this happens even if |
Looking at the boto.pyami.config code, we only load multiple .boto files if:
So in order to utilize multiple config files, you'll want to add the path of your repo-specific .boto config (which, from your description above, should only contain the config options I've shown below) to the set of paths in your BOTO_PATH variable. Note that they're loaded in order, so you should append that path, rather than prepend it.
I tested this myself with gsutil v4.22 by overriding the As for thobrla's comment, I'll get a fix out to ensure that when conditions 1 and 2 above are true, we show all readable config files in the output for |
Thanks @houglum! I'll give that a try. |
No such luck: ~$ head ~/.boto
# This file contains credentials and other configuration information needed
# by the boto library, used by gsutil. You can edit this file (e.g., to add
# credentials) but be careful not to mis-edit any of the variable names (like
# "gs_access_key_id") or remove important markers (like the "[Credentials]" and
# "[Boto]" section delimiters).
#
# This file was created by gsutil version 4.22 at 2017-02-26 10:29:13.
#
# You can create additional configuration files by running
# gsutil config [options] [-o <config-file>]
~$ cat /Users/foo/bar/.boto
[GSUtil]
use_magicfile = True
~$ unset BOTO_PATH
~$ gsutil ls
~$ echo $?
0
~$ export BOTO_PATH="/Users/foo/.boto"
~$ gsutil ls
ServiceException: 401 Anonymous users does not have storage.buckets.list access to project 9999999.
~$ export BOTO_PATH="/Users/foo/.boto:/Users/foo/bar/.boto"
~$ gsutil ls
ServiceException: 401 Anonymous users does not have storage.buckets.list access to project 9999999.
~$ export BOTO_PATH="/Users/foo/bar/.boto"
~$ gsutil ls
ServiceException: 401 Anonymous users does not have storage.buckets.list access to project 9999999. |
Oh hey, I can totally reproduce this today. I think the shell I was using yesterday had some leftover alias for gsutil such that I was invoking a non-gcloud version. Apologies for the confusion :) Anyway, upon realizing that, I figured out that this is a bug with the gsutil bootstrapping script that gcloud uses, /path-to-cloud-sdk/bin/bootstrapping/gsutil.py. Here's the culprit snippet:
That last line should be shifted left one indentation level so that it gets applied regardless of which predicates above were true. I'll let our gcloud folks know so we can get this fixed. (Also, WRT my previous comment, it looks like the gcloud script passes its configured default project as a top-level option, i.e. "-o 'GSUtil:default_project_id=...'", so one cannot overwrite the default project using a local .boto file.) |
Fixes issue mentioned in #376 where only one boto config is mentioned in the output for `gsutil version -l` in the case where we're actually loading several.
This fix as noted above is included in the most recent version of gcloud, and ce02232 fixes the config listing issue. Closing this. |
I can't seem to get gsutil to use the oAuth2.0 credentials that gcloud is using.
I used to have gsutil installed via pip and with 4.20 installed, I can do
gsutil config
and then it works fine.When installing from with the Cloud SDK
curl https://sdk.cloud.google.com | bash
I then run
gcloud auth login
go through those steps, and gcloud reports logged in.Gcloud info
gsutil -D
I've already updated boto to 2.42.0 via pip, tried reinstalling the cloud-sdk in another location.
I feel like I'm going round in circles.
The text was updated successfully, but these errors were encountered: