[Pkg-puppet-devel] [SCM] Packaging of Facter for debian branch, experimental_upstream, updated. 1.5.9-54-g5a4eeed

James Turnbull james at lovedthanlost.net
Wed Jun 22 08:51:51 UTC 2011


The following commit has been merged in the experimental_upstream branch:
commit 5b10173364a56458e3f2e8a44298722cda9321e7
Author: Adrien Thebo <adrien.thebo at gmail.com>
Date:   Tue Apr 5 12:18:11 2011 -0700

    (#5135) Fix faulty logic in physicalprocessorcount
    
     - Was doing unnessary string manipulation when all that needed to be
       done was a uniq'd array.
     - Removed some backwards way of nil checking.

diff --git a/lib/facter/physicalprocessorcount.rb b/lib/facter/physicalprocessorcount.rb
index c6145dc..22c00c1 100644
--- a/lib/facter/physicalprocessorcount.rb
+++ b/lib/facter/physicalprocessorcount.rb
@@ -39,10 +39,7 @@ Facter.add('physicalprocessorcount') do
       lookup_pattern = "#{sysfs_cpu_directory}" +
         "/cpu*/topology/physical_package_id"
 
-      ids = Dir.glob(lookup_pattern).collect { |f| Facter::Util::Resolution.exec("cat #{f}")}
-
-      ids = ids.join if ids.is_a?(Array)
-      ids.scan(/\d+/).uniq.size
+      Dir.glob(lookup_pattern).collect { |f| Facter::Util::Resolution.exec("cat #{f}")}.uniq.size
 
     else
       #
@@ -53,7 +50,7 @@ Facter.add('physicalprocessorcount') do
       #
       str = Facter::Util::Resolution.exec("grep 'physical.\\+:' /proc/cpuinfo")
 
-      if not str.nil? then str.scan(/\d+/).uniq.size; end
+      if str then str.scan(/\d+/).uniq.size; end
     end
   end
 end

-- 
Packaging of Facter for debian



More information about the Pkg-puppet-devel mailing list