Sha256: 3659b7c42ef66575ae54a61a5cce2a3a1e1515230747c0a94c412dd8eb41e7ff

Contents?: true

Size: 899 Bytes

Versions: 14

Compression:

Stored size: 899 Bytes

Contents

# frozen_string_literal: true

module Facter
  module Resolvers
    class Hardware < BaseResolver
      # :hardware
      init_resolver

      class << self
        private

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

        def read_hardware(fact_name)
          require_relative '../../../facter/util/aix/odm_query'
          odmquery = Facter::Util::Aix::ODMQuery.new
          odmquery
            .equals('name', 'sys0')
            .equals('attribute', 'modelname')

          result = odmquery.execute

          return unless result

          result.each_line do |line|
            if line.include?('value')
              @fact_list[:hardware] = line.split('=')[1].strip.delete('\"')
              break
            end
          end

          @fact_list[fact_name]
        end
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
facter-4.10.0 lib/facter/resolvers/aix/hardware.rb
facter-4.9.0 lib/facter/resolvers/aix/hardware.rb
facter-4.8.0 lib/facter/resolvers/aix/hardware.rb
facter-4.7.1 lib/facter/resolvers/aix/hardware.rb
facter-4.7.0 lib/facter/resolvers/aix/hardware.rb
facter-4.6.1 lib/facter/resolvers/aix/hardware.rb
facter-4.6.0 lib/facter/resolvers/aix/hardware.rb
facter-4.5.2 lib/facter/resolvers/aix/hardware.rb
facter-4.5.1 lib/facter/resolvers/aix/hardware.rb
facter-4.5.0 lib/facter/resolvers/aix/hardware.rb
facter-4.4.3 lib/facter/resolvers/aix/hardware.rb
facter-4.4.2 lib/facter/resolvers/aix/hardware.rb
facter-4.4.1 lib/facter/resolvers/aix/hardware.rb
facter-4.4.0 lib/facter/resolvers/aix/hardware.rb