summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith84@gmail.com>2020-11-06 22:18:44 -0800
committerTim Smith <tsmith84@gmail.com>2020-11-06 22:18:44 -0800
commit2299e0b135280311da749f2361d603c1d2e97d1a (patch)
tree522a4f3e15206b74b687e88bd8d450a3c8ec0dcc
parent1b82be4658be799e4ef47d68eee81a543d39ea5e (diff)
downloadohai-remove_legacy_lsb.tar.gz
Remove Linux LSB support for systems with lsb-release CLIremove_legacy_lsb
This was something we did for legacy Debian < 7. Seems like we're good to nuke this at this point since we don't ship on anything less than 9 now. Signed-off-by: Tim Smith <tsmith@chef.io>
-rw-r--r--lib/ohai/plugins/linux/lsb.rb16
-rw-r--r--spec/unit/plugins/linux/lsb_spec.rb34
2 files changed, 1 insertions, 49 deletions
diff --git a/lib/ohai/plugins/linux/lsb.rb b/lib/ohai/plugins/linux/lsb.rb
index 0f3497b7..7a351acc 100644
--- a/lib/ohai/plugins/linux/lsb.rb
+++ b/lib/ohai/plugins/linux/lsb.rb
@@ -39,22 +39,8 @@ Ohai.plugin(:LSB) do
lsb[:id] = line
end
end
- elsif file_exist?("/etc/lsb-release")
- # Old, non-standard Debian support
- file_open("/etc/lsb-release").each do |line|
- case line
- when /^DISTRIB_ID=["']?(.+?)["']?$/
- lsb[:id] = $1
- when /^DISTRIB_RELEASE=["']?(.+?)["']?$/
- lsb[:release] = $1
- when /^DISTRIB_CODENAME=["']?(.+?)["']?$/
- lsb[:codename] = $1
- when /^DISTRIB_DESCRIPTION=["']?(.+?)["']?$/
- lsb[:description] = $1
- end
- end
else
- logger.trace("Plugin LSB: Skipping LSB, cannot find /etc/lsb-release or /usr/bin/lsb_release")
+ logger.trace("Plugin LSB: Skipping LSB, cannot find /usr/bin/lsb_release")
end
end
end
diff --git a/spec/unit/plugins/linux/lsb_spec.rb b/spec/unit/plugins/linux/lsb_spec.rb
index 6bf9e321..9f8cadf9 100644
--- a/spec/unit/plugins/linux/lsb_spec.rb
+++ b/spec/unit/plugins/linux/lsb_spec.rb
@@ -26,40 +26,6 @@ describe Ohai::System, "Linux lsb plugin" do
allow(@plugin).to receive(:collect_os).and_return(:linux)
end
- describe "on systems with /etc/lsb-release" do
- before do
- @double_file = double("/etc/lsb-release")
- allow(@double_file).to receive(:each)
- .and_yield("DISTRIB_ID=Ubuntu")
- .and_yield("DISTRIB_RELEASE=8.04")
- .and_yield("DISTRIB_CODENAME=hardy")
- .and_yield('DISTRIB_DESCRIPTION="Ubuntu 8.04"')
- allow(File).to receive(:open).with("/etc/lsb-release").and_return(@double_file)
- allow(File).to receive(:exist?).with("/usr/bin/lsb_release").and_return(false)
- allow(File).to receive(:exist?).with("/etc/lsb-release").and_return(true)
- end
-
- it "sets lsb[:id]" do
- @plugin.run
- expect(@plugin[:lsb][:id]).to eq("Ubuntu")
- end
-
- it "sets lsb[:release]" do
- @plugin.run
- expect(@plugin[:lsb][:release]).to eq("8.04")
- end
-
- it "sets lsb[:codename]" do
- @plugin.run
- expect(@plugin[:lsb][:codename]).to eq("hardy")
- end
-
- it "sets lsb[:description]" do
- @plugin.run
- expect(@plugin[:lsb][:description]).to eq("Ubuntu 8.04")
- end
- end
-
describe "on systems with /usr/bin/lsb_release" do
before do
allow(File).to receive(:exist?).with("/usr/bin/lsb_release").and_return(true)