Skip to content

Retry GCE environment check for Application Default Credentials#110

Merged
tcoffee-google merged 4 commits intogoogleapis:masterfrom
tcoffee-google:retry_gce_check
Jun 30, 2017
Merged

Retry GCE environment check for Application Default Credentials#110
tcoffee-google merged 4 commits intogoogleapis:masterfrom
tcoffee-google:retry_gce_check

Conversation

@tcoffee-google
Copy link
Copy Markdown
Contributor

Adapt fix from Apiary client libraries. Currently untested.

Addresses #109.

Adapt fix from Apiary client libraries. Currently untested.

Addresses googleapis#109.
Copy link
Copy Markdown

@lukecwik lukecwik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like the changes done in the Apiary OAuth code and also addresses some other minor differences like the NO_GCE_CHECK and GCE_METADATA_HOST which aren't strictly required to fix the issue but I believe are a good idea to include in this change.

@@ -61,6 +63,22 @@ public class ComputeEngineCredentials extends GoogleCredentials {
"http://metadata/computeMetadata/v1/instance/service-accounts/default/token";

This comment was marked as spam.

This comment was marked as spam.

@@ -61,6 +63,22 @@ public class ComputeEngineCredentials extends GoogleCredentials {
"http://metadata/computeMetadata/v1/instance/service-accounts/default/token";
static final String METADATA_SERVER_URL = "http://metadata.google.internal";

This comment was marked as spam.

This comment was marked as spam.

return true;
/** Return whether code is running on Google Compute Engine. */
static boolean runningOnComputeEngine(
HttpTransportFactory transportFactory, DefaultCredentialsProvider provider) {

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

@tcoffee-google tcoffee-google changed the title WIP: Retry GCE environment check for Application Default Credentials Retry GCE environment check for Application Default Credentials Jun 30, 2017
}

public static String getTokenServerEncodedUrl() {
return getMetadataServerUrl() + "/computeMetadata/v1/instance/service-accounts/default/token";

This comment was marked as spam.

This comment was marked as spam.

assertEquals(transportFactory.transport.getRequestCount(), 0);
}

@Test

This comment was marked as spam.

This comment was marked as spam.

@lukecwik
Copy link
Copy Markdown

LGTM

@lukecwik
Copy link
Copy Markdown

When is the next scheduled release so that Apache Beam can incorporate these fixes?

@tcoffee-google
Copy link
Copy Markdown
Contributor Author

This is the only update since the last release, but I wouldn't mind doing another. @lesv do you have any objection?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants