lib/resolvers/processors_resolver.rb in facter-4.0.20 vs lib/resolvers/processors_resolver.rb in facter-4.0.21

- old
+ new

@@ -23,10 +23,11 @@ return if cpuinfo_output.empty? read_processors(cpuinfo_output) # + model names @fact_list[:physical_count] = @fact_list[:physical_processors].uniq.length + @fact_list[:physical_count] = physical_devices_count if @fact_list[:physical_count].zero? @fact_list[fact_name] end def read_processors(cpuinfo_output) @fact_list[:processors] = 0 @@ -48,9 +49,13 @@ @fact_list[:models] << tokens.last.strip if tokens.first.strip == 'model name' end def count_physical_processors(tokens) @fact_list[:physical_processors] << tokens.last.strip.to_i if tokens.first.strip == 'physical id' + end + + def physical_devices_count + Dir.entries('/sys/devices/system/cpu').count { |dir| dir =~ /cpu[0-9]+$/ } end end end end end