diff options
author | Bryan McLellan <btm@getchef.com> | 2014-05-15 09:32:17 -0700 |
---|---|---|
committer | Bryan McLellan <btm@getchef.com> | 2014-05-15 09:32:17 -0700 |
commit | 17297254f11168aa194a0951f59ad1729a6b509d (patch) | |
tree | cb31b3d5cee9304272253321234609821fafd91d | |
parent | 0f6059d2ea4dada41ab91c8373769950b84cb7b0 (diff) | |
parent | 227d43e1a8c30e5edcad8d8adc789b8e1355ce2e (diff) | |
download | ohai-17297254f11168aa194a0951f59ad1729a6b509d.tar.gz |
Merge branch 'OHAI-563'
-rw-r--r-- | lib/ohai/plugins/solaris2/platform.rb | 2 | ||||
-rw-r--r-- | spec/unit/plugins/solaris2/platform_spec.rb | 40 |
2 files changed, 41 insertions, 1 deletions
diff --git a/lib/ohai/plugins/solaris2/platform.rb b/lib/ohai/plugins/solaris2/platform.rb index ea10e7a8..4f9d9e9c 100644 --- a/lib/ohai/plugins/solaris2/platform.rb +++ b/lib/ohai/plugins/solaris2/platform.rb @@ -50,7 +50,7 @@ Ohai.plugin(:Platform) do when /^\s*(OpenSolaris).*snv_(\d+).*$/ platform "opensolaris" platform_version $2 - when /^\s*(Oracle Solaris) (\d+)\s.*$/ + when /^\s*(Oracle Solaris)/ platform "solaris2" when /^\s*(Solaris)\s.*$/ platform "solaris2" diff --git a/spec/unit/plugins/solaris2/platform_spec.rb b/spec/unit/plugins/solaris2/platform_spec.rb index ad0fc680..6fae7b95 100644 --- a/spec/unit/plugins/solaris2/platform_spec.rb +++ b/spec/unit/plugins/solaris2/platform_spec.rb @@ -65,4 +65,44 @@ UNAME_X end + describe "on Solaris 11" do + before(:each) do + @uname_x = <<-UNAME_X +System = SunOS +Node = node.example.com +Release = 5.11 +KernelID = 11.1 +Machine = i86pc +BusType = <unknown> +Serial = <unknown> +Users = <unknown> +OEM# = 0 +Origin# = 1 +NumCPU = 1 +UNAME_X + + File.stub(:exists?).with("/sbin/uname").and_return(true) + @plugin.stub(:shell_out).with("/sbin/uname -X").and_return(mock_shell_out(0, @uname_x, "")) + + @release = StringIO.new(" Oracle Solaris 11.1 X86\n") + File.stub(:open).with("/etc/release").and_yield(@release) + end + + it "should run uname and set platform and build" do + @plugin.run + @plugin[:platform_build].should == "11.1" + end + + it "should set the platform" do + @plugin.run + @plugin[:platform].should == "solaris2" + end + + it "should set the platform_version" do + @plugin.run + @plugin[:platform_version].should == "5.11" + end + + end + end |