summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2020-11-18 12:38:47 -0800
committerGitHub <noreply@github.com>2020-11-18 12:38:47 -0800
commita65dafabde60829332ae916f1136fb1b727f08ba (patch)
treed8260665858a9cbd06cc5dc653967ae648dceec5
parent393873093075b24de99d800ec4a8b414ea525291 (diff)
parentc8fc5004072d9eaec0801af4707b4d5487402d95 (diff)
downloadohai-a65dafabde60829332ae916f1136fb1b727f08ba.tar.gz
Merge pull request #1574 from chef/aix_kernel
Signed-off-by: Tim Smith <tsmith@chef.io>
-rw-r--r--lib/ohai/plugins/aix/kernel.rb10
-rw-r--r--spec/unit/plugins/aix/kernel_spec.rb9
2 files changed, 9 insertions, 10 deletions
diff --git a/lib/ohai/plugins/aix/kernel.rb b/lib/ohai/plugins/aix/kernel.rb
index 3d8178c8..a6d1cfee 100644
--- a/lib/ohai/plugins/aix/kernel.rb
+++ b/lib/ohai/plugins/aix/kernel.rb
@@ -24,10 +24,12 @@ Ohai.plugin(:Kernel) do
collect_data(:aix) do
kernel Mash.new
- kernel[:name] = shell_out("uname -s").stdout.split($/)[0].downcase
- kernel[:release] = shell_out("uname -r").stdout.split($/)[0]
- kernel[:version] = shell_out("uname -v").stdout.split($/)[0]
- kernel[:machine] = shell_out("uname -p").stdout.split($/)[0]
+ uname_so = shell_out("uname -srvp").stdout.split
+
+ kernel[:name] = uname_so[0].downcase
+ kernel[:release] = uname_so[1]
+ kernel[:version] = uname_so[2]
+ kernel[:machine] = uname_so[3]
kernel[:bits] = shell_out("getconf KERNEL_BITMODE").stdout.strip
modules = Mash.new
diff --git a/spec/unit/plugins/aix/kernel_spec.rb b/spec/unit/plugins/aix/kernel_spec.rb
index 40b15e15..b338e9a6 100644
--- a/spec/unit/plugins/aix/kernel_spec.rb
+++ b/spec/unit/plugins/aix/kernel_spec.rb
@@ -22,10 +22,7 @@ describe Ohai::System, "AIX kernel plugin" do
before do
@plugin = get_plugin("aix/kernel")
allow(@plugin).to receive(:collect_os).and_return(:aix)
- allow(@plugin).to receive(:shell_out).with("uname -s").and_return(mock_shell_out(0, "AIX", nil))
- allow(@plugin).to receive(:shell_out).with("uname -r").and_return(mock_shell_out(0, "1", nil))
- allow(@plugin).to receive(:shell_out).with("uname -v").and_return(mock_shell_out(0, "6", nil))
- allow(@plugin).to receive(:shell_out).with("uname -p").and_return(mock_shell_out(0, "powerpc", nil))
+ allow(@plugin).to receive(:shell_out).with("uname -srvp").and_return(mock_shell_out(0, "AIX 2 7 powerpc", nil))
allow(@plugin).to receive(:shell_out).with("genkex -d").and_return(mock_shell_out(0, " Text address Size Data address Size File\nf1000000c0338000 77000 f1000000c0390000 1ec8c /usr/lib/drivers/cluster\n 6390000 20000 63a0000 ba8 /usr/lib/drivers/if_en", nil))
allow(@plugin).to receive(:shell_out).with("getconf KERNEL_BITMODE").and_return(mock_shell_out(0, "64", nil))
@plugin.run
@@ -36,11 +33,11 @@ describe Ohai::System, "AIX kernel plugin" do
end
it "uname -r detects the release" do
- expect(@plugin[:kernel][:release]).to eq("1")
+ expect(@plugin[:kernel][:release]).to eq("2")
end
it "uname -v detects the version" do
- expect(@plugin[:kernel][:version]).to eq("6")
+ expect(@plugin[:kernel][:version]).to eq("7")
end
it "uname -p detects the machine" do