diff options
author | Tim Smith <tsmith@chef.io> | 2018-11-26 16:14:11 -0800 |
---|---|---|
committer | Tim Smith <tsmith@chef.io> | 2018-11-26 16:14:11 -0800 |
commit | 11e73519f412440656b0f451c0bf8675ed0fa8d4 (patch) | |
tree | d134b4dbd04639fbe948c130f1079f8f4b1d884f | |
parent | caceb5b9af91b4635c03a289be0f8cca0a08a043 (diff) | |
download | ohai-11e73519f412440656b0f451c0bf8675ed0fa8d4.tar.gz |
Move Arch and Alpine detection to os-release
These systems always have an os-release file. No need for the legacy method.
Signed-off-by: Tim Smith <tsmith@chef.io>
-rw-r--r-- | lib/ohai/plugins/linux/platform.rb | 8 | ||||
-rw-r--r-- | spec/unit/plugins/linux/platform_spec.rb | 17 |
2 files changed, 0 insertions, 25 deletions
diff --git a/lib/ohai/plugins/linux/platform.rb b/lib/ohai/plugins/linux/platform.rb index eb793458..6b40f9c0 100644 --- a/lib/ohai/plugins/linux/platform.rb +++ b/lib/ohai/plugins/linux/platform.rb @@ -262,19 +262,11 @@ Ohai.plugin(:Platform) do elsif File.exist?("/etc/slackware-version") platform "slackware" platform_version File.read("/etc/slackware-version").scan(/(\d+|\.+)/).join - elsif File.exist?("/etc/arch-release") - platform "arch" - # no way to determine platform_version in a rolling release distribution - # kernel release will be used - ex. 2.6.32-ARCH - platform_version `/bin/uname -r`.strip elsif File.exist?("/etc/exherbo-release") platform "exherbo" # no way to determine platform_version in a rolling release distribution # kernel release will be used - ex. 3.13 platform_version `/bin/uname -r`.strip - elsif File.exist?("/etc/alpine-release") - platform "alpine" - platform_version File.read("/etc/alpine-release").strip elsif File.exist?("/usr/lib/os-release") contents = File.read("/usr/lib/os-release") if /Clear Linux/ =~ contents diff --git a/spec/unit/plugins/linux/platform_spec.rb b/spec/unit/plugins/linux/platform_spec.rb index 98b87433..b14cc55f 100644 --- a/spec/unit/plugins/linux/platform_spec.rb +++ b/spec/unit/plugins/linux/platform_spec.rb @@ -470,23 +470,6 @@ OS_DATA end end - describe "on alpine" do - - let(:have_alpine_release) { true } - - before(:each) do - plugin.lsb = nil - end - - it "should set platform and platform_family to alpine" do - expect(File).to receive(:read).with("/etc/alpine-release").and_return("3.2.3") - plugin.run - expect(plugin[:platform]).to eq("alpine") - expect(plugin[:platform_family]).to eq("alpine") - expect(plugin[:platform_version]).to eq("3.2.3") - end - end - describe "on arista eos" do let(:have_eos_release) { true } |