diff options
author | Tim Smith <tsmith@chef.io> | 2016-04-04 09:42:32 -0700 |
---|---|---|
committer | Tim Smith <tsmith@chef.io> | 2016-04-04 09:42:32 -0700 |
commit | 793d22e0f6a35bc4ae9d4f23b614fbcb1d0da53e (patch) | |
tree | 0c74e62de7e9304fcacfb84282fb2a17d6db86f1 | |
parent | 996b50bf99ecf2d9489c39baedf5e92ce0db2ecd (diff) | |
parent | d41de06750d40e55768428afd008d403845eb689 (diff) | |
download | ohai-793d22e0f6a35bc4ae9d4f23b614fbcb1d0da53e.tar.gz |
Merge pull request #790 from juliandunn/aix-os-version
Set os_version to match the output of oslevel -s
-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..ecb3e22d 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.strip end end diff --git a/spec/unit/plugins/aix/os_spec.rb b/spec/unit/plugins/aix/os_spec.rb index 0d1e86e6..6cc2227d 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\n", 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 |