summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Chipman <rchipman@mit.edu>2015-02-01 11:58:03 -0500
committerBryan McLellan <btm@opscode.com>2015-02-17 12:40:48 -0500
commit550c1064c04186b65e3072c0af4405b09c7a62cd (patch)
tree0c5af3de788cccd3de19e60c5b90a18e1071564d
parent0ba54547f10233fc16cf5ffb65acae1644e2ecdb (diff)
downloadohai-550c1064c04186b65e3072c0af4405b09c7a62cd.tar.gz
get kernel version as platform version for archlinux
-rw-r--r--lib/ohai/plugins/linux/platform.rb2
-rw-r--r--spec/unit/plugins/linux/platform_spec.rb13
2 files changed, 15 insertions, 0 deletions
diff --git a/lib/ohai/plugins/linux/platform.rb b/lib/ohai/plugins/linux/platform.rb
index ed5f3499..b538d1da 100644
--- a/lib/ohai/plugins/linux/platform.rb
+++ b/lib/ohai/plugins/linux/platform.rb
@@ -87,10 +87,12 @@ Ohai.plugin(:Platform) do
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 `uname -r`.strip
elsif File.exists?('/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 `uname -r`.strip
elsif lsb[:id] =~ /RedHat/i
platform "redhat"
platform_version lsb[:release]
diff --git a/spec/unit/plugins/linux/platform_spec.rb b/spec/unit/plugins/linux/platform_spec.rb
index eff77c11..a20b0c01 100644
--- a/spec/unit/plugins/linux/platform_spec.rb
+++ b/spec/unit/plugins/linux/platform_spec.rb
@@ -170,6 +170,12 @@ describe Ohai::System, "Linux plugin platform" do
expect(@plugin[:platform_family]).to eq("arch")
end
+ it "should set platform_version to kernel release" do
+ expect(@plugin).to receive(:`).with('uname -r').and_return('3.18.2-2-ARCH')
+ @plugin.run
+ expect(@plugin[:platform_version]).to eq('3.18.2-2-ARCH')
+ end
+
end
describe "on gentoo" do
@@ -197,6 +203,13 @@ describe Ohai::System, "Linux plugin platform" do
expect(@plugin[:platform]).to eq("exherbo")
expect(@plugin[:platform_family]).to eq("exherbo")
end
+
+ it "should set platform_version to kernel release" do
+ expect(@plugin).to receive(:`).with('uname -r').and_return('3.18.2-2-ARCH')
+ @plugin.run
+ expect(@plugin[:platform_version]).to eq('3.18.2-2-ARCH')
+ end
+
end
describe "on redhat breeds" do