From: Krzysztof Wilczynski <krzysztof.wilczyn...@linux.com>
Signed-off-by: Adrien Thebo <adr...@puppetlabs.com> --- Local-branch: tickets/next/5135 lib/facter/physicalprocessorcount.rb | 12 +++++++++--- 1 files changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/facter/physicalprocessorcount.rb b/lib/facter/physicalprocessorcount.rb index d6fca6e..6772ccc 100644 --- a/lib/facter/physicalprocessorcount.rb +++ b/lib/facter/physicalprocessorcount.rb @@ -25,8 +25,12 @@ Facter.add('physicalprocessorcount') do # # (...) # - lookup_pattern = "#{sysfs_cpu_directory}/cpu*/topology/physical_package_id" - Dir[lookup_pattern].map { |i| File.read(i).strip }.uniq.size + lookup_pattern = "#{sysfs_cpu_directory}" + + "/cpu*/topology/physical_package_id" + + Facter::Util::Resolution.exec( + "cat #{lookup_pattern}" + ).scan(/\d+/).uniq.size else # # Try to count number of CPUs using the proc file system next ... @@ -34,7 +38,9 @@ Facter.add('physicalprocessorcount') do # We assume that /proc/cpuinfo has what we need and is so then we need # to make sure that we only count unique entries ... # - File.read('/proc/cpuinfo').scan(/physical.+:\s(\d+)/).uniq.size + Facter::Util::Resolution.exec( + "grep 'physical.\\+:' /proc/cpuinfo" + ).scan(/\d+/).uniq.size end end end -- 1.7.4.1 -- You received this message because you are subscribed to the Google Groups "Puppet Developers" group. To post to this group, send email to puppet-dev@googlegroups.com. To unsubscribe from this group, send email to puppet-dev+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en.