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.4.3 lib/facter/resolvers/sw_vers.rb
facter-4.4.2 lib/facter/resolvers/sw_vers.rb
facter-4.4.1 lib/facter/resolvers/sw_vers.rb
facter-4.4.0 lib/facter/resolvers/sw_vers.rb
facter-4.3.1 lib/facter/resolvers/sw_vers.rb
facter-4.3.0 lib/facter/resolvers/sw_vers.rb
facter-4.2.14 lib/facter/resolvers/sw_vers.rb
facter-4.2.13 lib/facter/resolvers/sw_vers.rb
facter-4.2.12 lib/facter/resolvers/sw_vers.rb
facter-4.2.11 lib/facter/resolvers/sw_vers.rb
facter-4.2.10 lib/facter/resolvers/sw_vers.rb
facter-4.2.9 lib/facter/resolvers/sw_vers.rb
facter-4.2.8 lib/facter/resolvers/sw_vers.rb
facter-4.2.7 lib/facter/resolvers/sw_vers.rb
facter-4.2.6 lib/facter/resolvers/sw_vers.rb
facter-4.2.5 lib/facter/resolvers/sw_vers.rb
facter-4.2.4 lib/facter/resolvers/sw_vers.rb
facter-4.2.3 lib/facter/resolvers/sw_vers.rb
facter-4.2.2 lib/facter/resolvers/sw_vers.rb
facter-4.2.1 lib/facter/resolvers/sw_vers.rb