class Facter::Resolvers::Lspci

Constants

REGEX_VALUES

Private Class Methods

lspci_command(fact_name) click to toggle source
# File lib/facter/resolvers/lspci.rb, line 20
def lspci_command(fact_name)
  output = Facter::Core::Execution.execute('lspci', logger: log)
  return if output.empty?

  @fact_list[:vm] = retrieve_vm(output)
  @fact_list[fact_name]
end
post_resolve(fact_name, _options) click to toggle source
# File lib/facter/resolvers/lspci.rb, line 16
def post_resolve(fact_name, _options)
  @fact_list.fetch(fact_name) { lspci_command(fact_name) }
end
retrieve_vm(output) click to toggle source
# File lib/facter/resolvers/lspci.rb, line 28
def retrieve_vm(output)
  output.each_line { |line| REGEX_VALUES.each { |key, value| return value if line =~ /#{key}/ } }

  nil
end