diff options
author | Tim Smith <tsmith84@gmail.com> | 2020-03-03 12:45:47 -0800 |
---|---|---|
committer | Tim Smith <tsmith84@gmail.com> | 2020-03-03 12:45:47 -0800 |
commit | 2c1c6f0987f59000d8ae764aff37a30055572feb (patch) | |
tree | 402ee2bd0f6a549214525aa7ebe53513f30ecda2 /lib/ohai/mixin | |
parent | 6162541a231c84d37dd03f3e3f679e97be4f279e (diff) | |
download | ohai-2c1c6f0987f59000d8ae764aff37a30055572feb.tar.gz |
Be defensive with the version response data
This way it doesn't blow up if azure changes the response
Signed-off-by: Tim Smith <tsmith@chef.io>
Diffstat (limited to 'lib/ohai/mixin')
-rw-r--r-- | lib/ohai/mixin/azure_metadata.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/ohai/mixin/azure_metadata.rb b/lib/ohai/mixin/azure_metadata.rb index d6d40aad..c96f074b 100644 --- a/lib/ohai/mixin/azure_metadata.rb +++ b/lib/ohai/mixin/azure_metadata.rb @@ -50,7 +50,7 @@ module Ohai end # azure returns a list of the 3 latest versions it supports - versions = parse_json(response.body)["newest-versions"] + versions = parse_json(response.body).fetch("newest-versions", []) versions.sort! until versions.empty? || AZURE_SUPPORTED_VERSIONS.include?(versions.last) |