Skip to content
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

Core: google.cloud._helpers._default_service_project_id() does not use project ID from active configuration #2588

Closed
tswast opened this issue Oct 21, 2016 · 5 comments
Assignees
Labels
api: core priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@tswast
Copy link
Contributor

tswast commented Oct 21, 2016

Problem (steps to reproduce)

Run gcloud init. Instead of updating the default configuration, make a new configuration (in my case, I called it "kittenbot"). Use a different project than you have for the default configuration. Note, you can switch between configurations using a command like: gcloud config configurations activate kittenbot.

Now, try to run any google-cloud-python library, notice that the paths it hit use project from the default configuration, not the active configuration. https://github.com/GoogleCloudPlatform/google-cloud-python/blob/ec781b6e8afc0b27599ddc69848571e1abf412ff/core/google/cloud/_helpers.py#L64 I noticed this problem because my GETs were failing in the RuntimeConfig, but it would be a worse problem with something like Datastore, where data could get written to the wrong project.

See similar issue in google-cloud-java: googleapis/google-cloud-java#827

This was fixed with: googleapis/google-cloud-java#831

Expected behavior

The default project should use the active configuration, not the default configuration.

@tswast tswast added type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. api: core labels Oct 21, 2016
@dhermes
Copy link
Contributor

dhermes commented Oct 22, 2016

@theacodes
Copy link
Contributor

Move this over to google-auth, it's getting closer and closer to ready.

On Fri, Oct 21, 2016, 4:54 PM Tim Swast [email protected] wrote:

Problem (steps to reproduce)

Run gcloud init. Instead of updating the default configuration, make a
new configuration (in my case, I called it "kittenbot"). Use a different
project than you have for the default configuration. Note, you can switch
between configurations using a command like: gcloud config configurations
activate kittenbot.

Now, try to run any google-cloud-python library, notice that the paths it
hit use project from the default configuration, not the active
configuration.
https://github.com/GoogleCloudPlatform/google-cloud-python/blob/ec781b6e8afc0b27599ddc69848571e1abf412ff/core/google/cloud/_helpers.py#L64
I noticed this problem because my GETs were failing in the RuntimeConfig,
but it would be a worse problem with something like Datastore, where data
could get written to the wrong project.

See similar issue in google-cloud-java:
googleapis/google-cloud-java#827
googleapis/google-cloud-java#827

This was fixed with: googleapis/google-cloud-java#831
googleapis/google-cloud-java#831
Expected behavior

The default project should use the active configuration, not the default
configuration.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#2588,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAPUc_NzSpMiRQiSCj1pgGTd5W4wUvk4ks5q2VC-gaJpZM4KdsN9
.

@dhermes
Copy link
Contributor

dhermes commented Oct 25, 2016

w00t!

@theacodes
Copy link
Contributor

Filed over at googleapis/google-auth-library-python#53

@lukesneeringer lukesneeringer added the priority: p2 Moderately-important priority. Fix may not be included in next release. label Apr 19, 2017
@dhermes
Copy link
Contributor

dhermes commented Aug 8, 2017

@jonparrott Is this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: core priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

No branches or pull requests

4 participants