lib/facter/operatingsystemrelease.rb in facter-1.7.3 vs lib/facter/operatingsystemrelease.rb in facter-1.7.4.rc1

- old
+ new

@@ -3,11 +3,11 @@ # Purpose: Returns the release of the operating system. # # Resolution: # On RedHat derivatives, returns their '/etc/<variant>-release' file. # On Debian, returns '/etc/debian_version'. -# On Ubuntu, parses '/etc/issue' for the release version. +# On Ubuntu, parses '/etc/lsb-release' for the release version. # On Suse, derivatives, parses '/etc/SuSE-release' for a selection of version # information. # On Slackware, parses '/etc/slackware-version'. # On Amazon Linux, returns the 'lsbdistrelease' value. # On Mageia, parses '/etc/mageia-release' for the release version. @@ -59,11 +59,11 @@ end Facter.add(:operatingsystemrelease) do confine :operatingsystem => %w{Ubuntu} setcode do - if release = Facter::Util::FileRead.read('/etc/issue') - if match = release.match(/Ubuntu ((\d+.\d+)(\.(\d+))?)/) + if release = Facter::Util::FileRead.read('/etc/lsb-release') + if match = release.match(/DISTRIB_RELEASE=((\d+.\d+)(\.(\d+))?)/) # Return only the major and minor version numbers. This behavior must # be preserved for compatibility reasons. match[2] end end