Google-cloud-python: Core: `google.cloud._helpers._default_service_project_id()` does not use project ID from active configuration

Created on 22 Oct 2016  Â·  5Comments  Â·  Source: googleapis/google-cloud-python

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: https://github.com/GoogleCloudPlatform/google-cloud-java/issues/827

This was fixed with: https://github.com/GoogleCloudPlatform/google-cloud-java/pull/831

Expected behavior

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

bug core p2

Most helpful comment

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:
GoogleCloudPlatform/google-cloud-java#827
https://github.com/GoogleCloudPlatform/google-cloud-java/issues/827

This was fixed with: GoogleCloudPlatform/google-cloud-java#831
https://github.com/GoogleCloudPlatform/google-cloud-java/pull/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
https://github.com/GoogleCloudPlatform/google-cloud-python/issues/2588,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAPUc_NzSpMiRQiSCj1pgGTd5W4wUvk4ks5q2VC-gaJpZM4KdsN9
.

All 5 comments

Ick! I think @jonparrott is putting this all in https://github.com/GoogleCloudPlatform/google-auth-library-python/

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:
GoogleCloudPlatform/google-cloud-java#827
https://github.com/GoogleCloudPlatform/google-cloud-java/issues/827

This was fixed with: GoogleCloudPlatform/google-cloud-java#831
https://github.com/GoogleCloudPlatform/google-cloud-java/pull/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
https://github.com/GoogleCloudPlatform/google-cloud-python/issues/2588,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAPUc_NzSpMiRQiSCj1pgGTd5W4wUvk4ks5q2VC-gaJpZM4KdsN9
.

w00t!

@jonparrott Is this

Was this page helpful?
0 / 5 - 0 ratings