1. confined to only run on if virtual => physical
        Don't think listing the cpu in a solaris
        container (zone) is required or a good idea.
2 confined to only run on solaris 10/11, 8/9 wont work.

Signed-off-by: Merritt Krakowitzer <[email protected]>
---
 lib/facter/physicalprocessorcount.rb |   11 +++++++++++
 lib/facter/processor.rb              |   11 +++++++++++
 2 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/lib/facter/physicalprocessorcount.rb b/lib/facter/
physicalprocessorcount.rb
index 22c00c1..ec60d4a 100644
--- a/lib/facter/physicalprocessorcount.rb
+++ b/lib/facter/physicalprocessorcount.rb
@@ -54,3 +54,14 @@ Facter.add('physicalprocessorcount') do
     end
   end
 end
+
+if Facter.value(:kernel) == "SunOS"
+  Facter.add("physicalprocessorcount") do
+    confine :operatingsystem => :solaris
+    confine :operatingsystemrelease => %w{5.10 5.11}
+    confine :virtual => :physical
+    setcode do
+      Facter::Util::Resolution.exec("/usr/sbin/psrinfo -p")
+    end
+  end
+end
diff --git a/lib/facter/processor.rb b/lib/facter/processor.rb
index ec196b2..1533d44 100644
--- a/lib/facter/processor.rb
+++ b/lib/facter/processor.rb
@@ -104,3 +104,14 @@ if Facter.value(:kernel) == "OpenBSD"
         end
     end
 end
+
+if Facter.value(:kernel) == "SunOS"
+    Facter.add("ProcessorCount") do
+        confine :operatingsystem => :solaris
+        confine :operatingsystemrelease => %w{5.10 5.11}
+        confine :virtual => :physical
+        setcode do
+            Facter::Util::Resolution.exec("/usr/bin/kstat cpu_info | /
usr/bin/grep core_id | /usr/bin/uniq | /usr/bin/wc -l").strip
+        end
+    end
+end
--
1.7.5.4

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?hl=en.

Reply via email to