class LoomExt::CoreFacts::FacterProvider

Public Class Methods

new(host_spec, shell) click to toggle source
# File lib/loomext/corefacts/facter_provider.rb, line 8
def initialize(host_spec, shell)
  @has_facter = shell.test :which, "facter"
  disable(host_spec) unless @has_facter
  @shell = shell
  @namespace = :facter
end

Public Instance Methods

collect_facts() click to toggle source
# File lib/loomext/corefacts/facter_provider.rb, line 15
def collect_facts
  unless @has_facter
    Loom.log.error "facter not installed"
    return {}
  end

  yaml_facts = @shell.capture :facter, "--yaml"
  yaml_facts.nil? ? {} : YAML.load(yaml_facts)
end