Skip to content

Commit

Permalink
Handle non-200 response codes in response to EC2 best_api_version query
Browse files Browse the repository at this point in the history
  • Loading branch information
javmorin committed Apr 12, 2013
1 parent 1904600 commit 4f0f1ee
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions lib/ohai/mixin/ec2_metadata.rb
Expand Up @@ -76,6 +76,7 @@ def can_metadata_connect?(addr, port, timeout=2)

def best_api_version
response = http_client.get("/")
return nil if (response.code != '200')
versions = response.body.split("\n")
until (versions.empty? || EC2_SUPPORTED_VERSIONS.include?(versions.last)) do
pv = versions.pop
Expand Down

0 comments on commit 4f0f1ee

Please sign in to comment.