source: src/puppetcode/environments/test/modules/stdlib/lib/facter/puppet_vardir.rb@ 748a227

debian/bullseye debian/jessie
Last change on this file since 748a227 was 1c22429, checked in by Joachim Langenbach <joachim.langenbach@…>, 10 years ago
  • gnuboat_epd adds the apt repository from gnuboat to install epd-fuse package
  • Property mode set to 100644
File size: 937 bytes
Line 
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.
5#
6# The value should be directly usable in a File resource path attribute.
7
8
9begin
10 require 'facter/util/puppet_settings'
11rescue LoadError => e
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
17end
18
19Facter.add(:puppet_vardir) do
20 setcode do
21 # This will be nil if Puppet is not available.
22 Facter::Util::PuppetSettings.with_puppet do
23 Puppet[:vardir]
24 end
25 end
26end
Note: See TracBrowser for help on using the repository browser.