Sha256: 9b23d0a7a513c11b712019a0fc5b74811ccbf9274844a1f6e76e107478e0b865

Contents?: true

Size: 802 Bytes

Versions: 14

Compression:

Stored size: 802 Bytes

Contents

# frozen_string_literal: true

module Facts
  module Debian
    module Os
      module Distro
        class Release
          FACT_NAME = 'os.distro.release'

          def call_the_resolver
            fact_value = determine_release_for_os

            Facter::ResolvedFact.new(FACT_NAME, fact_value)
          end

          private

          def determine_release_for_os
            release = Facter::Resolvers::DebianVersion.resolve(:version)
            return unless release

            versions = release.split('.')
            fact_value = {}
            fact_value['full'] = release
            fact_value['major'] = versions[0]
            fact_value['minor'] = versions[1].gsub(/^0([1-9])/, '\1') if versions[1]
            fact_value
          end
        end
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
facter-4.0.35 lib/facter/facts/debian/os/distro/release.rb
facter-4.0.34 lib/facter/facts/debian/os/distro/release.rb
facter-4.0.33 lib/facter/facts/debian/os/distro/release.rb
facter-4.0.32 lib/facter/facts/debian/os/distro/release.rb
facter-4.0.31 lib/facter/facts/debian/os/distro/release.rb
facter-4.0.30 lib/facter/facts/debian/os/distro/release.rb
facter-4.0.29 lib/facts/debian/os/distro/release.rb
facter-4.0.28 lib/facts/debian/os/distro/release.rb
facter-4.0.26 lib/facts/debian/os/distro/release.rb
facter-4.0.25 lib/facts/debian/os/distro/release.rb
facter-4.0.24 lib/facts/debian/os/distro/release.rb
facter-4.0.23 lib/facts/debian/os/distro/release.rb
facter-4.0.22 lib/facts/debian/os/distro/release.rb
facter-4.0.21 lib/facts/debian/os/distro/release.rb