Sha256: cf6db1cc6cf6bee6d7c253993a443f39bd641fff4077709276eb53a08bddfa6a
Contents?: true
Size: 922 Bytes
Versions: 14
Compression:
Stored size: 922 Bytes
Contents
# frozen_string_literal: true module Facter module Resolvers class Wpar < BaseResolver @semaphore = Mutex.new @fact_list ||= {} class << self private def post_resolve(fact_name) @fact_list.fetch(fact_name) { read_wpar(fact_name) } end def read_wpar(fact_name) lpar_cmd = '/usr/bin/lparstat -W 2>/dev/null' output, status = Open3.capture2(lpar_cmd) return nil unless status.success? output.each_line do |line| populate_wpar_data(line.split(':').map(&:strip)) end @fact_list[fact_name] end def populate_wpar_data(key_value) @fact_list[:wpar_key] = key_value[1].to_i if key_value[0] == 'WPAR Key' @fact_list[:wpar_configured_id] = key_value[1].to_i if key_value[0] == 'WPAR Configured ID' end end end end end
Version data entries
14 entries across 14 versions & 1 rubygems