Sha256: 052aef21285424c322186331bfbc71f58902e2be26a7689d497f82a21b03683d

Contents?: true

Size: 758 Bytes

Versions: 26

Compression:

Stored size: 758 Bytes

Contents

# frozen_string_literal: true

module Facter
  module Resolvers
    class SwVers < BaseResolver
      # :productname
      # :productversion
      # :buildversion

      init_resolver

      class << self
        private

        def post_resolve(fact_name, _options)
          @fact_list.fetch(fact_name) { software_version_system_call(fact_name) }
        end

        def software_version_system_call(fact_name)
          output = Facter::Core::Execution.execute('sw_vers', logger: log)
          release_info = output.delete("\t").split("\n").map { |e| e.split(':') }
          result = Hash[*release_info.flatten]
          result.each { |k, v| @fact_list[k.downcase.to_sym] = v }
          @fact_list[fact_name]
        end
      end
    end
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
facter-4.2.0 lib/facter/resolvers/sw_vers.rb
facter-4.1.1 lib/facter/resolvers/sw_vers.rb
facter-4.1.0 lib/facter/resolvers/sw_vers.rb
facter-4.0.52 lib/facter/resolvers/sw_vers.rb
facter-4.0.51 lib/facter/resolvers/sw_vers.rb
facter-4.0.50 lib/facter/resolvers/sw_vers.rb