-
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
Add logic to fetch the latest azure metadata version #1427
Conversation
708e4bf
to
3a5ceb4
Compare
3a5ceb4
to
9930e8c
Compare
This is inspired by the way we do this in EC2, but it's different in many ways since Azure presents the latest version in a different way. Signed-off-by: Tim Smith <tsmith@chef.io>
9930e8c
to
808ce32
Compare
From review Signed-off-by: Tim Smith <tsmith@chef.io>
This way it doesn't blow up if azure changes the response Signed-off-by: Tim Smith <tsmith@chef.io>
logger.trace("Mixin AzureMetadata: Received HTTP 404 from metadata server while determining API version, assuming #{AZURE_SUPPORTED_VERSIONS.last}") | ||
return AZURE_SUPPORTED_VERSIONS.last | ||
elsif response.code != "400" # 400 is actually what we want | ||
raise "Mixin AzureMetadata: Unable to determine Azure metadata version (returned #{response.code} response)" |
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.
I'm really unfamiliar with the conventions of this project, but should this return a specific error type rather than the generic error?
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.
Most places in Ohai are just generic errors
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.
I had some code-style suggestions but overall this is good 👍
Updates from review Signed-off-by: Tim Smith <tsmith@chef.io>
No need for this Signed-off-by: Tim Smith <tsmith@chef.io>
This is inspired by the way we do this in EC2, but it's different in
many ways since Azure presents the latest version in a different way.
Additional values exposed by this:
Signed-off-by: Tim Smith tsmith@chef.io