lib/facter/custom_facts/util/confine.rb in facter-4.2.2 vs lib/facter/custom_facts/util/confine.rb in facter-4.2.3

- old
+ new

@@ -39,32 +39,38 @@ def true? if @block && !@fact begin return !!@block.call rescue StandardError => e - LegacyFacter.debug "Confine raised #{e.class} #{e}" + log.debug "Confine raised #{e.class} #{e}" return false end end unless (fact = Facter[@fact]) - LegacyFacter.debug format('No fact for %<fact>s', fact: @fact) + log.debug format('No fact for %<fact>s', fact: @fact) return false end value = convert(fact.value) return false if value.nil? if @block begin return !!@block.call(value) rescue StandardError => e - LegacyFacter.debug "Confine raised #{e.class} #{e}" + log.debug "Confine raised #{e.class} #{e}" return false end end @values.any? { |v| convert(v) === value } + end + + private + + def log + @log ||= Facter::Log.new(self) end end end end