Moved custom facts and functions into one module

This commit is contained in:
Gene Liverman 2017-10-15 17:37:43 -07:00
parent c8d218fee8
commit cc631cb462
3 changed files with 0 additions and 0 deletions

View file

@ -0,0 +1,19 @@
Facter.add(:os_release) do
confine kernel: 'Linux'
setcode do
file_path = '/etc/os-release'
if File.exist?(file_path)
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
end
end
os_release_hash
end
end
end