Sha256: fceae4a81cb04a42768893e69f94973d9a62c1b1c9efdf42ae157e5761cf29f2

Contents?: true

Size: 881 Bytes

Versions: 22

Compression:

Stored size: 881 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 '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

22 entries across 22 versions & 1 rubygems

Version Path
facter-4.3.1 lib/facter/resolvers/aix/hardware.rb
facter-4.3.0 lib/facter/resolvers/aix/hardware.rb
facter-4.2.14 lib/facter/resolvers/aix/hardware.rb
facter-4.2.13 lib/facter/resolvers/aix/hardware.rb
facter-4.2.12 lib/facter/resolvers/aix/hardware.rb
facter-4.2.11 lib/facter/resolvers/aix/hardware.rb
facter-4.2.10 lib/facter/resolvers/aix/hardware.rb
facter-4.2.9 lib/facter/resolvers/aix/hardware.rb
facter-4.2.8 lib/facter/resolvers/aix/hardware.rb
facter-4.2.7 lib/facter/resolvers/aix/hardware.rb
facter-4.2.6 lib/facter/resolvers/aix/hardware.rb
facter-4.2.5 lib/facter/resolvers/aix/hardware.rb
facter-4.2.4 lib/facter/resolvers/aix/hardware.rb
facter-4.2.3 lib/facter/resolvers/aix/hardware.rb
facter-4.2.2 lib/facter/resolvers/aix/hardware.rb
facter-4.2.1 lib/facter/resolvers/aix/hardware.rb
facter-4.2.0 lib/facter/resolvers/aix/hardware.rb
facter-4.1.1 lib/facter/resolvers/aix/hardware.rb
facter-4.1.0 lib/facter/resolvers/aix/hardware.rb
facter-4.0.52 lib/facter/resolvers/aix/hardware.rb