module Beaker::DSL::Helpers::Facter

Methods that help you interact with your facter installation, facter must be installed for these methods to execute correctly

Public Instance Methods

fact(name, opts = {}) click to toggle source

Get a facter fact from the default host @see fact_on

# File lib/beaker-facter/helpers.rb, line 82
def fact(name, opts = {})
  fact_on(default, name, opts)
end
fact_on(host, name, opts = {}) click to toggle source

Get a facter fact from a provided host

@param [Host, Array<Host>, String, Symbol] host One or more hosts to act upon,

or a role (String or Symbol) that identifies one or more hosts.

@param [String] name The name of the fact to query for @!macro common_opts

@return String The value of the fact 'name' on the provided host @raise [FailTest] Raises an exception if call to facter fails

# File lib/beaker-facter/helpers.rb, line 71
def fact_on(host, name, opts = {})
  result = on host, facter(name, opts)
  if result.kind_of?(Array)
    result.map { |res| res.stdout.chomp }
  else
    result.stdout.chomp
  end
end