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 = {} os_release_hash = {}
File.open(file_path, 'r') do |file| File.open(file_path, 'r') do |file|
file.each_line do |line| file.each_line do |line|
line_data = line.split('=') unless line.nil? or line.strip.length.eql? 0
key = line_data[0].downcase line_data = line.split('=')
value = line_data[1].strip.gsub(/(^\")|(\"$)/, '') key = line_data[0].downcase
os_release_hash[key] = value value = line_data[1].strip.gsub(/(^\")|(\"$)/, '')
os_release_hash[key] = value
end
end end
end end
os_release_hash os_release_hash