Module: Facter::Util::Operatingsystem

Defined in:
lib/facter/util/operatingsystem.rb

Class Method Summary collapse

Class Method Details

.os_release(file = '/etc/os-release') ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/facter/util/operatingsystem.rb', line 6

def self.os_release(file = '/etc/os-release')
  values = {}

  if File.readable?(file)
    File.readlines(file).each do |line|
      if (match = line.match(/^(\w+)=["']?(.+?)["']?$/))
        values[match[1]] = match[2]
      end
    end
  end

  values
end