summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIsa Farnik <isa@chef.co>2015-10-26 13:05:57 +0000
committerIsa Farnik <isa@chef.co>2015-10-26 13:15:59 +0000
commit9af358e9b87b7833fc989234e0e0e7dbf08cfd79 (patch)
tree6bbede407ce305ed5d542b7c53528a9895ea831f
parent081589066eefa00a60192f8cac8801e3b2b31bfe (diff)
downloadohai-if/aix-bittiness.tar.gz
provide aix kernel bitinessif/aix-bittiness
specs test for bits not for machine
-rw-r--r--lib/ohai/plugins/aix/kernel.rb3
-rw-r--r--spec/unit/plugins/aix/kernel_spec.rb5
2 files changed, 7 insertions, 1 deletions
diff --git a/lib/ohai/plugins/aix/kernel.rb b/lib/ohai/plugins/aix/kernel.rb
index ed189057..bf84de8c 100644
--- a/lib/ohai/plugins/aix/kernel.rb
+++ b/lib/ohai/plugins/aix/kernel.rb
@@ -22,10 +22,11 @@ Ohai.plugin(:Kernel) do
collect_data(:aix) do
kernel Mash.new
- kernel[:name] = shell_out("uname -s").stdout.split($/)[0].downcase
+ 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]
+ kernel[:bits] = shell_out("getconf KERNEL_BITMODE").stdout.strip
modules = Mash.new
so = shell_out("genkex -d")
diff --git a/spec/unit/plugins/aix/kernel_spec.rb b/spec/unit/plugins/aix/kernel_spec.rb
index 2428a25a..85756962 100644
--- a/spec/unit/plugins/aix/kernel_spec.rb
+++ b/spec/unit/plugins/aix/kernel_spec.rb
@@ -26,6 +26,7 @@ describe Ohai::System, "AIX kernel plugin" do
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("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
end
@@ -45,6 +46,10 @@ describe Ohai::System, "AIX kernel plugin" do
expect(@plugin[:kernel][:machine]).to eq("powerpc")
end
+ it "getconf KERNEL_BITMODE detects the kernel's bittiness" do
+ expect(@plugin[:kernel][:bits]).to eq("64")
+ end
+
it "detects the modules" do
expect(@plugin[:kernel][:modules]["/usr/lib/drivers/cluster"]["text"]).to eq({ "address" => "f1000000c0338000", "size" => "77000" })
expect(@plugin[:kernel][:modules]["/usr/lib/drivers/cluster"]["data"]).to eq({ "address" => "f1000000c0390000", "size" => "1ec8c" })