lib/facts/debian/os/release.rb in facter-4.0.13 vs lib/facts/debian/os/release.rb in facter-4.0.14

- old
+ new

@@ -6,23 +6,35 @@ class Release FACT_NAME = 'os.release' ALIASES = %w[operatingsystemmajrelease operatingsystemrelease].freeze def call_the_resolver - fact_value = Facter::Resolvers::LsbRelease.resolve(:release) + fact_value = determine_release_for_os return Facter::ResolvedFact.new(FACT_NAME, nil) unless fact_value versions = fact_value.split('.') release = { 'full' => fact_value, 'major' => versions[0], - 'minor' => versions[1] + 'minor' => versions[1].gsub(/^0([1-9])/, '\1') } [Facter::ResolvedFact.new(FACT_NAME, release), Facter::ResolvedFact.new(ALIASES.first, versions[0], :legacy), Facter::ResolvedFact.new(ALIASES.last, fact_value, :legacy)] + end + + private + + def determine_release_for_os + os_name = Facter::Resolvers::OsRelease.resolve(:name) + + if os_name =~ /Debian|Raspbian/ + Facter::Resolvers::DebianVersion.resolve(:version) + else + Facter::Resolvers::OsRelease.resolve(:version_id) + end end end end end end