Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

OHAI-345 Mac OS X platform_family support #64

Closed
wants to merge 1 commit into from

2 participants

Chris Gaffney Bryan McLellan
Chris Gaffney

This will return mac_os_x for platform_family for bot OS X and OS X Server

http://tickets.opscode.com/browse/OHAI-345

Bryan McLellan
Owner
btm commented April 19, 2012

In the future please use a topic branch instead of master that is named after the ticket, i.e. OHAI-345. Thanks for the patch! I've merged this to master.

http://wiki.opscode.com/display/chef/How+to+Contribute

Bryan McLellan btm closed this April 19, 2012
Chris Gaffney

Will do! Thanks for the heads up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Mar 22, 2012
Chris Gaffney Add platform_family support for OS X and OS X Server. 1b5fadd
This page is out of date. Refresh to see the latest.
6  lib/ohai/plugins/darwin/platform.rb
@@ -16,7 +16,7 @@
16 16
 # limitations under the License.
17 17
 #
18 18
 
19  
-provides "platform", "platform_version", "platform_build"
  19
+provides "platform", "platform_version", "platform_build", "platform_family"
20 20
 
21 21
 popen4("/usr/bin/sw_vers") do |pid, stdin, stdout, stderr|
22 22
   stdin.close
@@ -33,4 +33,6 @@
33 33
       platform_build $1
34 34
     end
35 35
   end
36  
-end
  36
+end
  37
+
  38
+platform_family "mac_os_x"
34  spec/ohai/plugins/darwin/platform_spec.rb
@@ -64,4 +64,36 @@
64 64
     @ohai._require_plugin("darwin::platform")
65 65
     @ohai[:platform_build].should == "9F33"
66 66
   end
67  
-end
  67
+
  68
+  it "should set platform_family to mac_os_x" do
  69
+    @ohai._require_plugin("darwin::platform")
  70
+    @ohai[:platform_family].should == "mac_os_x"
  71
+  end
  72
+
  73
+  describe "on os x server" do
  74
+    before(:each) do
  75
+      @ohai = Ohai::System.new
  76
+      @ohai.stub!(:require_plugin).and_return(true)
  77
+      @ohai[:os] = "darwin"
  78
+      @pid = 10
  79
+      @stdin = mock("STDIN", { :close => true })
  80
+      @stdout = mock("STDOUT")
  81
+      @stdout.stub!(:each).
  82
+        and_yield("ProductName:	Mac OS X Server").
  83
+        and_yield("ProductVersion:	10.6.8").
  84
+        and_yield("BuildVersion:	10K549")
  85
+      @stderr = mock("STDERR")
  86
+      @ohai.stub!(:popen4).with("/usr/bin/sw_vers").and_yield(@pid, @stdin, @stdout, @stderr)
  87
+    end
  88
+
  89
+    it "should set platform to mac_os_x_server" do
  90
+      @ohai._require_plugin("darwin::platform")
  91
+      @ohai[:platform].should == "mac_os_x_server"
  92
+    end
  93
+
  94
+    it "should set platform_family to mac_os_x" do
  95
+      @ohai._require_plugin("darwin::platform")
  96
+      @ohai[:platform_family].should == "mac_os_x"
  97
+    end
  98
+  end
  99
+end
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.