summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2018-10-10 12:23:57 -0700
committerTim Smith <tsmith@chef.io>2018-10-29 21:55:29 -0700
commitfd675360d6577128a3fd43658c419920cefa6e7d (patch)
tree6c554ea00d70c990d5b1f87f0124b911ae316fb2
parent8875919981873e796ecdefc0e5d963a1adf92612 (diff)
downloadohai-sles15.tar.gz
Correctly detect SLES 15 systems as "suse" platformsles15
This was a mistake when we introduced it. The system self identifies as SLES, but we need to make that suse to align with SLES 11/12 detection in Ohai. Signed-off-by: Tim Smith <tsmith@chef.io>
-rw-r--r--lib/ohai/plugins/linux/platform.rb2
-rw-r--r--spec/unit/plugins/linux/platform_spec.rb2
2 files changed, 2 insertions, 2 deletions
diff --git a/lib/ohai/plugins/linux/platform.rb b/lib/ohai/plugins/linux/platform.rb
index a9e24d46..79ee4217 100644
--- a/lib/ohai/plugins/linux/platform.rb
+++ b/lib/ohai/plugins/linux/platform.rb
@@ -291,7 +291,7 @@ Ohai.plugin(:Platform) do
# We have to do this for compatibility reasons, or older OS releases might get different
# "platform" or "platform_version" attributes (e.g. SLES12, RHEL7).
elsif File.exist?("/etc/os-release")
- platform os_release_info["ID"]
+ platform os_release_info["ID"] == "sles" ? "suse" : os_release_info["ID"] # SLES is wrong. We call it SUSE
platform_version os_release_info["VERSION_ID"]
# platform_family also does not need to be hardcoded anymore.
# This would be the correct way, but we stick with "determine_platform_family" for compatibility reasons.
diff --git a/spec/unit/plugins/linux/platform_spec.rb b/spec/unit/plugins/linux/platform_spec.rb
index 42e94e00..2a7ab73b 100644
--- a/spec/unit/plugins/linux/platform_spec.rb
+++ b/spec/unit/plugins/linux/platform_spec.rb
@@ -727,7 +727,7 @@ OS_RELEASE
it "correctly detects SLES15" do
@plugin.run
- expect(@plugin[:platform]).to eq("sles")
+ expect(@plugin[:platform]).to eq("suse")
expect(@plugin[:platform_version]).to eq("15")
expect(@plugin[:platform_family]).to eq("suse")
end