lib/facter/resolvers/dmi.rb in facter-4.4.1 vs lib/facter/resolvers/dmi.rb in facter-4.4.2
- old
+ new
@@ -34,10 +34,10 @@
board_serial chassis_asset_tag chassis_type sys_vendor product_name
product_serial product_uuid]
return unless File.directory?('/sys/class/dmi')
file_content = Facter::Util::FileHelper.safe_read("/sys/class/dmi/id/#{fact_name}", nil)
- .encode('UTF-8', invalid: :replace)
+ file_content = file_content.encode('UTF-8', invalid: :replace) if file_content
if files.include?(fact_name.to_s) && file_content
file_content = file_content.strip
@fact_list[fact_name] = file_content unless file_content.empty?
chassis_to_name(@fact_list[fact_name]) if fact_name == :chassis_type
end