Sha256: 0148afcb575e14fe7b4d00348ee9d9f219cb070064f4474b85cf2c0213952d60

Contents?: true

Size: 787 Bytes

Versions: 10

Compression:

Stored size: 787 Bytes

Contents

# frozen_string_literal: true

module Facter
  module Resolvers
    class SwVers < BaseResolver
      # :productname
      # :productversion
      # :productversionextra
      # :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

10 entries across 10 versions & 1 rubygems

Version Path
facter-4.10.0 lib/facter/resolvers/sw_vers.rb
facter-4.9.0 lib/facter/resolvers/sw_vers.rb
facter-4.8.0 lib/facter/resolvers/sw_vers.rb
facter-4.7.1 lib/facter/resolvers/sw_vers.rb
facter-4.7.0 lib/facter/resolvers/sw_vers.rb
facter-4.6.1 lib/facter/resolvers/sw_vers.rb
facter-4.6.0 lib/facter/resolvers/sw_vers.rb
facter-4.5.2 lib/facter/resolvers/sw_vers.rb
facter-4.5.1 lib/facter/resolvers/sw_vers.rb
facter-4.5.0 lib/facter/resolvers/sw_vers.rb