Sha256: b762e666d54359ee32436be47f040db8030af9c6c6d2e046dc3c21e73f126250

Contents?: true

Size: 788 Bytes

Versions: 8

Compression:

Stored size: 788 Bytes

Contents

# frozen_string_literal: true

module Facter
  module Resolvers
    class SuseRelease < BaseResolver
      # :name
      # :version
      # :codename

      @fact_list ||= {}

      class << self
        private

        def post_resolve(fact_name)
          @fact_list.fetch(fact_name) { read_suse_release(fact_name) }
        end

        def read_suse_release(fact_name)
          output = Util::FileHelper.safe_read('/etc/SuSE-release', nil)
          return @fact_list[fact_name] = nil if output.nil?

          output_strings = output.split(' ')

          @fact_list[:name] = output_strings[0]
          @fact_list[:version] = output_strings[1]
          @fact_list[:identifier] = @fact_list[:name].downcase

          @fact_list[fact_name]
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
facter-4.0.44 lib/facter/resolvers/suse_release_resolver.rb
facter-4.0.43 lib/facter/resolvers/suse_release_resolver.rb
facter-4.0.42 lib/facter/resolvers/suse_release_resolver.rb
facter-4.0.41 lib/facter/resolvers/suse_release_resolver.rb
facter-4.0.40 lib/facter/resolvers/suse_release_resolver.rb
facter-4.0.39 lib/facter/resolvers/suse_release_resolver.rb
facter-4.0.38 lib/facter/resolvers/suse_release_resolver.rb
facter-4.0.37 lib/facter/resolvers/suse_release_resolver.rb