[Pkg-puppet-devel] [facter] 164/180: (FACT-476) Make the 'processor' fact for OpenBSD consistent with other operating systems.

Stig Sandbeck Mathisen ssm at debian.org
Mon Jun 30 15:06:44 UTC 2014


This is an automated email from the git hooks/post-receive script.

ssm pushed a commit to branch master
in repository facter.

commit d12321564bb4c242dc5c89e823549b05d9c6873f
Author: Jasper Lievisse Adriaanse <jasper at humppa.nl>
Date:   Fri May 2 22:46:20 2014 +0200

    (FACT-476) Make the 'processor' fact for OpenBSD consistent with other operating systems.
---
 lib/facter/processor.rb     | 11 +++--------
 spec/unit/processor_spec.rb |  7 +++++++
 2 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/lib/facter/processor.rb b/lib/facter/processor.rb
index 9182c95..6794a83 100644
--- a/lib/facter/processor.rb
+++ b/lib/facter/processor.rb
@@ -7,8 +7,8 @@
 #   On Linux and kFreeBSD, parse '/proc/cpuinfo' for each processor.
 #   On AIX, parse the output of 'lsdev' for its processor section.
 #   On Solaris, parse the output of 'kstat' for each processor.
-#   On OpenBSD, use 'uname -p' and the sysctl variable for 'hw.ncpu' for CPU
-#   count.
+#   On OpenBSD, use the sysctl variables 'hw.model' and 'hw.ncpu'
+#   for the CPU model and the CPU count respectively.
 #
 # Caveats:
 #
@@ -89,11 +89,6 @@ Facter.add("ProcessorCount") do
   end
 end
 
-Facter.add("Processor") do
-  confine :kernel => :openbsd
-  setcode "uname -p"
-end
-
 Facter.add("ProcessorCount") do
   confine :kernel => :Darwin
   setcode do
@@ -138,7 +133,7 @@ if Facter.value(:kernel) == "windows"
 end
 
 Facter.add("Processor") do
-  confine :kernel => [:dragonfly,:freebsd]
+  confine :kernel => [:dragonfly,:freebsd,:openbsd]
   setcode do
     Facter::Util::POSIX.sysctl("hw.model")
   end
diff --git a/spec/unit/processor_spec.rb b/spec/unit/processor_spec.rb
index 15112a3..e059736 100755
--- a/spec/unit/processor_spec.rb
+++ b/spec/unit/processor_spec.rb
@@ -198,6 +198,13 @@ describe "Processor facts" do
       Facter.fact(:processorcount).value.should == "2"
     end
 
+    it "should print the correct CPU Model on OpenBSD" do
+      Facter.fact(:kernel).stubs(:value).returns("OpenBSD")
+      Facter::Util::POSIX.stubs(:sysctl).with("hw.model").returns('SomeVendor CPU 4.2GHz')
+
+      Facter.fact(:processor).value.should == "SomeVendor CPU 4.2GHz"
+    end
+
     it "should be 2 on dual-processor FreeBSD box" do
       Facter.fact(:kernel).stubs(:value).returns("FreeBSD")
       Facter::Util::POSIX.stubs(:sysctl).with("hw.ncpu").returns('2')

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-puppet/facter.git



More information about the Pkg-puppet-devel mailing list