lib/facter/resolvers/memory_resolver.rb in facter-4.0.36 vs lib/facter/resolvers/memory_resolver.rb in facter-4.0.37

- old
+ new

@@ -2,11 +2,10 @@ module Facter module Resolvers module Linux class Memory < BaseResolver - @semaphore = Mutex.new @fact_list ||= {} @log = Facter::Log.new(self) class << self private @@ -46,10 +45,15 @@ end def reclaimable_memory(output) buffers = kilobytes_to_bytes(output.match(/Buffers:\s+(\d+)\s/)[1]) cached = kilobytes_to_bytes(output.match(/Cached:\s+(\d+)\s/)[1]) - s_reclaimable = kilobytes_to_bytes(output.match(/SReclaimable:\s+(\d+)\s/)[1]) + s_reclaimable = output.match(/SReclaimable:\s+(\d+)\s/) + s_reclaimable = if s_reclaimable + kilobytes_to_bytes(s_reclaimable[1]) + else + 0 + end @fact_list[:memfree] + buffers + cached + s_reclaimable end def compute_capacity(used, total) format('%<computed_capacity>.2f', computed_capacity: (used / total.to_f * 100)) + '%'