Skip to content

Instantly share code, notes, and snippets.

@dalen
Created September 18, 2013 11:16
Show Gist options
  • Save dalen/6607716 to your computer and use it in GitHub Desktop.
Save dalen/6607716 to your computer and use it in GitHub Desktop.
"lib/puppet/indirector/facts/ohaifacter.rb" 14L, 544C
require 'puppet/node/facts'
require 'puppet/indirector/code'
class Puppet::Node::Facts::Ohaifacter < Puppet::Indirector::Code
desc "Retrieve facts from Ohai and Facter.
Merges facts from both facts terminii preferring Ohai facts if there is a conflict."
# Look up a host's facts
def find(request)
facter = Puppet::Node::Facts.indirection.terminus(:facter).find(request)
ohai = Puppet::Node::Facts.indirection.terminus(:ohai).find(request)
Puppet::Node::Facts.new(request.key, facter.values.merge(ohai.values))
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment