-
Notifications
You must be signed in to change notification settings - Fork 151
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for the pull request. Please find my comments inline.
sysvars/sysvars.go
Outdated
@@ -110,6 +110,10 @@ func Init(ll *logger.Logger, userVars map[string]string) error { | |||
if err := gceVars(sysVars); err != nil { | |||
return err | |||
} | |||
} else { | |||
if err := getEC2Meta(sysVars); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will fail on all non-AWS environments? Is there a way to run getEC2Meta only while on AWS?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like there is no way, short of looking at the hypervisor uuid file. In that case, I think we should log the error and ignore it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will not fail, when the metadata is not available it sets a boolean sysvar and returns nil.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See line 31 in the ec2 file
return fmt.Errorf("Could not get instance document %v", err) | ||
} | ||
|
||
sysVars["EC2_METADATA_Availabile"] = "true" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of adding all the variables by default, I'd start with a few that are useful for probing (also, some of this information may be security risk, e.g. DevpayProductCodes, AccountID).
Can you start with only: AvailabilityZone, Region, InstanceID, PrivateIP and may be ImageID?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed sensitive info, added ramdisk and architecture to the list
Replied inline and changed |
Just a heads up, I'll committing this using the process described here: |
Set sysvars relevant for EC2 instances when running on Amazon's EC2