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

gomplate v1.9.0 - fails for aws.EC2 calls that take 1s or plus (Windows) #168

Closed
chrix-3E8 opened this issue Jun 15, 2017 · 4 comments
Closed
Assignees
Labels

Comments

@chrix-3E8
Copy link

Running gomplate in a windows docker container in an Win2016 EC2 instance (gomplate_windows-amd64-slim.exe)

In such context, about one in 5 or 10 calls to EC2 service takes 1s or +. In such case, gomplate doesn't wait enough. See last output below.
PS C:> echo '{{aws.EC2Region "unknown" -}}' | ./gomplate
us-east-1
PS C:> echo '{{aws.EC2Region "unknown" -}}' | ./gomplate
us-east-1
PS C:> echo '{{aws.EC2Region "unknown" -}}' | ./gomplate
us-east-1
PS C:> echo '{{aws.EC2Region "unknown" -}}' | ./gomplate
unknown

Should it wait more in the line below?
https://github.com/hairyhenderson/gomplate/blob/master/aws/ec2info.go#L45

The equivalent call does work every time - but it does occasionally take 1s+
(Invoke-WebRequest 'http://169.254.169.254/latest/dynamic/instance-identity/document').Content

Why it sometimes takes 1s+ is probably due to running inside a container and having to add this rule (windows docker containers do not have access to Amazon service by default)
[string] $gatewayIpAddress = (Get-NetIPConfiguration -All).IPv4DefaultGateway.NextHop
route add 169.254.169.254 $gatewayIpAddress

@chrix-3E8
Copy link
Author

Trying to build a version of gomplate that waits 5s

@chrix-3E8
Copy link
Author

yep confirmed, that fixes the pb

@hairyhenderson
Copy link
Owner

@chrix-3E8 I think the right approach is to support an environment variable (AWS_TIMEOUT or something), to allow the default timeout of 500ms to be overridden. I'll see about getting that in a release soon.

@hairyhenderson
Copy link
Owner

@chrix-3E8 I've released v1.9.1 just now with support for an AWS_TIMEOUT environment variable - this should fix the problem for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants