[Pkg-puppet-devel] [facter] 86/180: Add physicalprocessorcount fact for OpenBSD
Stig Sandbeck Mathisen
ssm at debian.org
Mon Jun 30 15:06:34 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 cad0799caa6cdf4ea74d2531e95c405e746e7ac9
Author: Jasper Lievisse Adriaanse <jasper at humppa.nl>
Date: Thu Jun 27 22:59:20 2013 +0200
Add physicalprocessorcount fact for OpenBSD
---
lib/facter/physicalprocessorcount.rb | 7 +++++++
spec/unit/physicalprocessorcount_spec.rb | 8 ++++++++
2 files changed, 15 insertions(+)
diff --git a/lib/facter/physicalprocessorcount.rb b/lib/facter/physicalprocessorcount.rb
index 68917af..3263e20 100644
--- a/lib/facter/physicalprocessorcount.rb
+++ b/lib/facter/physicalprocessorcount.rb
@@ -80,3 +80,10 @@ Facter.add('physicalprocessorcount') do
end
end
end
+
+Facter.add('physicalprocessorcount') do
+ confine :kernel => :openbsd
+ setcode do
+ Facter::Util::Resolution.exec("sysctl -n hw.ncpufound")
+ end
+end
diff --git a/spec/unit/physicalprocessorcount_spec.rb b/spec/unit/physicalprocessorcount_spec.rb
index acdd646..af7aa76 100755
--- a/spec/unit/physicalprocessorcount_spec.rb
+++ b/spec/unit/physicalprocessorcount_spec.rb
@@ -73,4 +73,12 @@ describe "Physical processor count facts" do
end
end
end
+
+ describe "on openbsd" do
+ it "should return 4 physical CPUs" do
+ Facter.fact(:kernel).stubs(:value).returns("OpenBSD")
+ Facter::Util::Resolution.expects(:exec).with("sysctl -n hw.ncpufound").returns("4")
+ Facter.fact(:physicalprocessorcount).value.should == "4"
+ end
+ end
end
--
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