diff options
author | Thom May <thom@may.lt> | 2016-03-31 09:18:47 +0100 |
---|---|---|
committer | Thom May <thom@may.lt> | 2016-03-31 09:18:47 +0100 |
commit | 2766d816cab002bb6360e53392e592e33b97a199 (patch) | |
tree | cce3660f55fdb24979b0be5972f448f54ac76e28 | |
parent | 02defc6ff5ce01204656ae4715c4fdce68843e2e (diff) | |
parent | b84d1e78d60cb626bf2d65f2d5207e40520c0d34 (diff) | |
download | ohai-2766d816cab002bb6360e53392e592e33b97a199.tar.gz |
Merge pull request #784 from tas50/master
Detect openSUSE Leap as platform opensuseleap
-rw-r--r-- | lib/ohai/plugins/linux/platform.rb | 7 | ||||
-rw-r--r-- | spec/unit/plugins/linux/platform_spec.rb | 7 |
2 files changed, 13 insertions, 1 deletions
diff --git a/lib/ohai/plugins/linux/platform.rb b/lib/ohai/plugins/linux/platform.rb index 9455e788..d70c2874 100644 --- a/lib/ohai/plugins/linux/platform.rb +++ b/lib/ohai/plugins/linux/platform.rb @@ -125,7 +125,12 @@ Ohai.plugin(:Platform) do suse_version = suse_release[/VERSION = ([\d\.]{2,})/, 1] if suse_version == "" platform_version suse_version if suse_release =~ /^openSUSE/ - platform "opensuse" + # opensuse releases >= 42 are openSUSE Leap + if platform_version.to_i < 42 + platform "opensuse" + else + platform "opensuseleap" + end else platform "suse" end diff --git a/spec/unit/plugins/linux/platform_spec.rb b/spec/unit/plugins/linux/platform_spec.rb index 0e924169..5dccc929 100644 --- a/spec/unit/plugins/linux/platform_spec.rb +++ b/spec/unit/plugins/linux/platform_spec.rb @@ -665,6 +665,13 @@ CISCO_RELEASE expect(@plugin[:platform]).to eq("opensuse") expect(@plugin[:platform_family]).to eq("suse") end + + it "should read the platform as opensuseleap on openSUSE Leap" do + expect(File).to receive(:read).with("/etc/SuSE-release").and_return("openSUSE 42.1 (x86_64)\nVERSION = 42.1\nCODENAME = Malachite\n") + @plugin.run + expect(@plugin[:platform]).to eq("opensuseleap") + expect(@plugin[:platform_family]).to eq("suse") + end end end |