-
Notifications
You must be signed in to change notification settings - Fork 449
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
Properly poll Openstack metadata + other Openstack improvements #818
Conversation
The existing Openstack metadata logic failed as it was hardcoded to use metadata from 2013 that doesn't seem to exist in standard installs. Instead lets use the logic in the EC2 metadata mixin to find the latest version we support. Wrap metadata fetching around socket connection check from the EC2 metadata plugin. This prevents hung Ohai runs on providers that don't support the metadata endpoint Grab the Openstack data correctly in the Cloud plugins Detect a system as being on Openstack based on DMI data Remove HP cloud logic since that's dead Add debug logging so we can follow what's happening in the logs better
🤘 this is awesome sauce. |
Test DMI data path, remove openstack specific metadata since we're not gathering this at the moment.
This makes it easier to write recipes without being super defensive in your code
def collect_openstack_metadata(addr = Ohai::Mixin::Ec2Metadata::EC2_METADATA_ADDR, api_version = "2013-04-04") | ||
path = "/openstack/#{api_version}/meta_data.json" | ||
uri = "http://#{addr}#{path}" | ||
# dreamhost systems hae the dhc-user on them |
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.
have
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.
fixed
some tweaks, but 👍 |
This reverts nesting the attributes in openstack['metadata']. This matches what we do in other clouds
@@ -189,7 +189,7 @@ def get_openstack_values | |||
cloud[:public_hostname] = openstack["public_hostname"] | |||
cloud[:local_ipv4] = openstack["local_ipv4"] | |||
cloud[:local_hostname] = openstack["local_hostname"] | |||
cloud[:provider] = openstack["provider"] | |||
cloud[:provider] = "openstack" |
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 looks like this can sometimes be "dreamhost"?
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.
So this one gets a bit weird and here's why I went with openstack. When you're in the context of the cloud plugin says provider you'd think openstack (right? maybe...). When you're in the context of the openstack plugin you know you're openstack so when someone says provider you're thinking about what openstack provider and that could be dreamhost. I guess it could really go either way though.
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 could be breaking for some users. Though I understand your argument, I think it's safer to keep it as it was.
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.
The previous behavior was HP or Openstack, but I'll switch this one back. People on Dreamhost can figure it out probably.
👍 🚀 🎉 |
The existing Openstack metadata logic failed as it was hardcoded to use metadata from 2013 that doesn't seem to exist in standard installs. Instead lets use the logic in the EC2 metadata mixin to find the latest version we support.
Wrap metadata fetching around socket connection check from the EC2 metadata plugin. This prevents hung Ohai runs on providers that don't support the metadata endpoint
Grab the Openstack data correctly in the Cloud plugins
Detect a system as being on Openstack based on DMI data
Remove HP cloud logic since that's dead
Add debug logging so we can follow what's happening in the logs better
Previously nil data we now have: