class Facter::Resolvers::Hardware

Private Class Methods

post_resolve(fact_name, _options) click to toggle source
# File lib/facter/resolvers/aix/hardware.rb, line 12
def post_resolve(fact_name, _options)
  @fact_list.fetch(fact_name) { read_hardware(fact_name) }
end
read_hardware(fact_name) click to toggle source
# File lib/facter/resolvers/aix/hardware.rb, line 16
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