mirror of
https://github.com/genebean/dots.git
synced 2026-03-27 09:27:44 -04:00
Revert "Moving fact to the same place as the custom function"
This reverts commit e546635780.
This commit is contained in:
parent
e546635780
commit
c8d218fee8
1 changed files with 0 additions and 0 deletions
19
puppet/production/site/custom_facts/lib/facter/os_release.rb
Normal file
19
puppet/production/site/custom_facts/lib/facter/os_release.rb
Normal 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue