Sha256: 30b4cdf7f85eef3903355048e799c08a09c09ea9fb4c8658d558d395107c95ea

Contents?: true

Size: 811 Bytes

Versions: 1

Compression:

Stored size: 811 Bytes

Contents

# frozen_string_literal: true

module Facts
  module Debian
    module Os
      class Release
        FACT_NAME = 'os.release'
        ALIASES = %w[operatingsystemmajrelease operatingsystemrelease].freeze

        def call_the_resolver
          fact_value = Facter::Resolvers::LsbRelease.resolve(:release)

          return Facter::ResolvedFact.new(FACT_NAME, nil) unless fact_value

          versions = fact_value.split('.')
          release = {
            'full' => fact_value,
            'major' => versions[0],
            'minor' => versions[1]
          }

          [Facter::ResolvedFact.new(FACT_NAME, release),
           Facter::ResolvedFact.new(ALIASES.first, versions[0], :legacy),
           Facter::ResolvedFact.new(ALIASES.last, fact_value, :legacy)]
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
facter-4.0.13 lib/facts/debian/os/release.rb