diff options
author | Adrien Thebo <adrien.thebo@gmail.com> | 2011-04-05 12:18:11 -0700 |
---|---|---|
committer | James Turnbull <james@lovedthanlost.net> | 2011-04-06 07:08:24 +1000 |
commit | 5b10173364a56458e3f2e8a44298722cda9321e7 (patch) | |
tree | a896629974a143ee9e0fc57488a48270956e6098 /lib | |
parent | d5bec9713ba31746fb4de631ea5afb9a9453e3b2 (diff) | |
download | facter-5b10173364a56458e3f2e8a44298722cda9321e7.tar.gz facter-5b10173364a56458e3f2e8a44298722cda9321e7.tar.xz facter-5b10173364a56458e3f2e8a44298722cda9321e7.zip |
(#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.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/facter/physicalprocessorcount.rb | 7 |
1 files changed, 2 insertions, 5 deletions
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 |