Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AIX: Set os_version to match the output of oslevel -s #790

Merged
merged 3 commits into from
Apr 4, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/ohai/plugins/aix/os.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@

collect_data(:aix) do
os collect_os
os_version kernel[:version]
os_version shell_out("oslevel -s").stdout.strip
end
end
11 changes: 6 additions & 5 deletions spec/unit/plugins/aix/os_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,16 @@
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