Updated to handle blank lines

This commit is contained in:
Gene Liverman 2018-02-10 20:11:13 -08:00
parent d9492851f4
commit 4591546207

View file

@ -7,10 +7,12 @@ Facter.add(:os_release) do
os_release_hash = {}
File.open(file_path, 'r') do |file|
file.each_line do |line|
line_data = line.split('=')
key = line_data[0].downcase
value = line_data[1].strip.gsub(/(^\")|(\"$)/, '')
os_release_hash[key] = value
unless line.nil? or line.strip.length.eql? 0
line_data = line.split('=')
key = line_data[0].downcase
value = line_data[1].strip.gsub(/(^\")|(\"$)/, '')
os_release_hash[key] = value
end
end
end
os_release_hash