diff options
author | Tim Smith <tsmith84@gmail.com> | 2020-08-09 17:42:03 -0700 |
---|---|---|
committer | Tim Smith <tsmith84@gmail.com> | 2020-08-09 17:42:03 -0700 |
commit | afe6b233d0dbec64c6d7304c9e976d53c755ef4d (patch) | |
tree | 8bb7483757ce210e15b62e7bc1cf093ae6463dfb | |
parent | a120ce8074a07c9549eeabb03dac742467e7cf8b (diff) | |
download | ohai-afe6b233d0dbec64c6d7304c9e976d53c755ef4d.tar.gz |
Avoid a constant we don't actually need
Signed-off-by: Tim Smith <tsmith@chef.io>
-rw-r--r-- | lib/ohai/plugins/linux/platform.rb | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/lib/ohai/plugins/linux/platform.rb b/lib/ohai/plugins/linux/platform.rb index 15c122bf..569be257 100644 --- a/lib/ohai/plugins/linux/platform.rb +++ b/lib/ohai/plugins/linux/platform.rb @@ -20,21 +20,6 @@ Ohai.plugin(:Platform) do provides "platform", "platform_version", "platform_family" depends "lsb" - # the platform mappings between the 'ID' field in /etc/os-release and the value - # ohai uses. If you're adding a new platform here and you want to change the name - # you'll want to add it here and then add a spec for the platform_id_remap method - PLATFORM_MAPPINGS ||= { - "rhel" => "redhat", - "amzn" => "amazon", - "ol" => "oracle", - "sles" => "suse", - "sles_sap" => "suse", - "opensuse-leap" => "opensuseleap", - "xenenterprise" => "xenserver", - "cumulus-linux" => "cumulus", - "archarm" => "arch", - }.freeze - # @deprecated def get_redhatish_platform(contents) contents[/^Red Hat/i] ? "redhat" : contents[/(\w+)/i, 1].downcase @@ -122,8 +107,20 @@ Ohai.plugin(:Platform) do # this catches the centos guest shell in the nexus switch which identifies itself as centos return "nexus_centos" if id == "centos" && os_release_file_is_cisco? - # remap based on the hash of platforms - PLATFORM_MAPPINGS[id] || id + # the platform mappings between the 'ID' field in /etc/os-release and the value + # ohai uses. If you're adding a new platform here and you want to change the name + # you'll want to add it here and then add a spec for the platform_id_remap method + { + "rhel" => "redhat", + "amzn" => "amazon", + "ol" => "oracle", + "sles" => "suse", + "sles_sap" => "suse", + "opensuse-leap" => "opensuseleap", + "xenenterprise" => "xenserver", + "cumulus-linux" => "cumulus", + "archarm" => "arch", + }[id] || id end # |