mirror of
https://github.com/genebean/dots.git
synced 2026-03-27 09:27:44 -04:00
Updated to handle blank lines
This commit is contained in:
parent
d9492851f4
commit
4591546207
1 changed files with 6 additions and 4 deletions
|
|
@ -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
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue