-
Notifications
You must be signed in to change notification settings - Fork 453
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
Adds more resilient GCE checking #1292
Conversation
@nathenharvey you have a slight chefstyle error. If you auto correct it that should get cleared up |
lib/ohai/plugins/gce.rb
Outdated
# Identifies gce | ||
# | ||
# === Return | ||
# true:: If gce can be identified | ||
# false:: Otherwise | ||
def looks_like_gce? | ||
hint?("gce") || has_gce_metadata? | ||
hint?("gce") || has_gce_dmi? || has_gce_system_info? || has_gce_metadata? |
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 should probably get refactored to be more like what we're doing in AWS
https://github.com/chef/ohai/blob/master/lib/ohai/plugins/ec2.rb#L108
Then you can just kill off has_gce_metadata?
Also this will make it so that we're only attempting to connect to metadata when we really look like gce. That allows us to switch over to the IP vs. name based URL as well.
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.
refactored. This will now only attempt to connect to the metadata server when the system info indicates that this node is on GCE. Would you like to switch to IP based GCE_METADATA_ADDR
in the same PR?
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.
Getting close. Take a look at the comment I left for the ordering of when we try to metadata connect
1f4844d
to
a986add
Compare
Check the system information to determine if this system is running on Google Compute Engine. See also the Google Cloud Documentation for [detecting if you are running in Compute Engine](https://cloud.google.com/compute/docs/instances/managing-instances#dmi). Signed-off-by: Nathen Harvey <nathenharvey@google.com> Update release notes Signed-off-by: Nathen Harvey <nathenharvey@google.com>
a986add
to
ad9bdc7
Compare
Looks great. Thanks @nathenharvey |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Description
Check the system information to determine if this system is running on Google Compute Engine.
See also the Google Cloud Documentation for detecting if you are running in Compute Engine.
Check List
Signed-off-by: Nathen Harvey nathenharvey@google.com