diff options
author | Julian C. Dunn <jdunn@chef.io> | 2016-04-01 13:02:32 -0400 |
---|---|---|
committer | Julian C. Dunn <jdunn@chef.io> | 2016-04-01 13:02:32 -0400 |
commit | d726641965b050883767f7e40c673bfc14c9b651 (patch) | |
tree | c05ad3ead7f5e1a20c503755cca41f22bf673768 | |
parent | af291324a73ac44836cadafd96114a535b681b43 (diff) | |
download | ohai-d726641965b050883767f7e40c673bfc14c9b651.tar.gz |
Set os_version to match the output of oslevel -s instead of just the
major version of AIX.
-rw-r--r-- | lib/ohai/plugins/aix/os.rb | 2 | ||||
-rw-r--r-- | spec/unit/plugins/aix/os_spec.rb | 11 |
2 files changed, 7 insertions, 6 deletions
diff --git a/lib/ohai/plugins/aix/os.rb b/lib/ohai/plugins/aix/os.rb index ebbe760d..cf17182b 100644 --- a/lib/ohai/plugins/aix/os.rb +++ b/lib/ohai/plugins/aix/os.rb @@ -25,6 +25,6 @@ Ohai.plugin(:OS) do collect_data(:aix) do os collect_os - os_version kernel[:version] + os_version shell_out("oslevel -s").stdout.split($/)[0] end end diff --git a/spec/unit/plugins/aix/os_spec.rb b/spec/unit/plugins/aix/os_spec.rb index 0d1e86e6..6cc8cf37 100644 --- a/spec/unit/plugins/aix/os_spec.rb +++ b/spec/unit/plugins/aix/os_spec.rb @@ -20,15 +20,16 @@ require File.expand_path(File.dirname(__FILE__) + "/../../../spec_helper.rb") describe Ohai::System, "AIX os plugin" do before(:each) do @plugin = get_plugin("aix/os") - kernel = Mash.new - kernel[:version] = "6" - kernel[:release] = "1" allow(@plugin).to receive(:collect_os).and_return(:aix) - allow(@plugin).to receive(:kernel).and_return(kernel) + allow(@plugin).to receive(:shell_out).with("oslevel -s").and_return(mock_shell_out(0, "7200-00-01-1543", nil)) @plugin.run end + it "should set the top-level os attribute" do + expect(@plugin[:os]).to eql(:aix) + end + it "should set the top-level os_level attribute" do - expect(@plugin[:os_version]).to eql("6") + expect(@plugin[:os_version]).to eql("7200-00-01-1543") end end |