Sha256: 97613ff566c6e549c05a061f21d018e84b2901a3a5e725970fe7c17b85a4e870
Contents?: true
Size: 862 Bytes
Versions: 8
Compression:
Stored size: 862 Bytes
Contents
# frozen_string_literal: true module Facter module Resolvers class Hardware < BaseResolver # :hardware @fact_list ||= {} class << self private def post_resolve(fact_name) @fact_list.fetch(fact_name) { read_hardware(fact_name) } end def read_hardware(fact_name) require_relative 'utils/odm_query' odmquery = Facter::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
8 entries across 8 versions & 1 rubygems