Skip to content

Commit

Permalink
OHAI-349: Fix regression in os fallback to ruby host_os
Browse files Browse the repository at this point in the history
  • Loading branch information
btm committed Mar 29, 2012
1 parent 672095b commit 5d2323c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/ohai/plugins/os.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
# subsystems.
os "windows"
else
Object.const_get(defined?(RbConfig) ? :RbConfig : :Config)::CONFIG['host_os']
os ::RbConfig::CONFIG['host_os']
end

os_version kernel[:release]
11 changes: 11 additions & 0 deletions spec/ohai/plugins/os_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,15 @@
@ohai[:os].should == "solaris2"
end
end

describe "on something we have never seen before, but ruby has" do
before do
::RbConfig::CONFIG['host_os'] = "tron"
end

it "sets the os to the ruby 'host_os'" do
@ohai._require_plugin("os")
@ohai[:os].should == "tron"
end
end
end

0 comments on commit 5d2323c

Please sign in to comment.