1 # This facter fact returns the value of the Puppet vardir setting for the node
2 # running puppet or puppet agent. The intent is to enable Puppet modules to
3 # automatically have insight into a place where they can place variable data,
4 # regardless of the node's platform.
6 # The value should be directly usable in a File resource path attribute.
10 require 'facter/util/puppet_settings'
12 # puppet apply does not add module lib directories to the $LOAD_PATH (See
13 # #4248). It should (in the future) but for the time being we need to be
14 # defensive which is what this rescue block is doing.
15 rb_file = File.join(File.dirname(__FILE__), 'util', 'puppet_settings.rb')
16 load rb_file if File.exists?(rb_file) or raise e
19 Facter.add(:puppet_vardir) do
21 # This will be nil if Puppet is not available.
22 Facter::Util::PuppetSettings.with_puppet do