<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -58,6 +58,19 @@ rescue Exception
     $haveusage = false
 end
 
+def load_puppet
+    require 'puppet'
+    Puppet.parse_config
+
+    # If you've set 'vardir' but not 'libdir' in your
+    # puppet.conf, then the hook to add libdir to $:
+    # won't get triggered.  This makes sure that it's setup
+    # correctly.
+    unless $LOAD_PATH.include?(Puppet[:libdir])
+        $LOAD_PATH &lt;&lt; Puppet[:libdir]
+    end
+end
+
 $debug = 0
 
 config = nil
@@ -83,7 +96,7 @@ begin
             exit
         when &quot;--puppet&quot;
             begin
-                require 'puppet'
+                load_puppet()
             rescue LoadError =&gt; detail
                 $stderr.puts &quot;Could not load Puppet: %s&quot; % detail
             end</diff>
      <filename>bin/facter</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>d89ea7a88a93b6ce3132d9dd394b4187eb460cb2</id>
    </parent>
  </parents>
  <author>
    <name>Luke Kanies</name>
    <email>luke@madstop.com</email>
  </author>
  <url>http://github.com/pnasrat/facter/commit/516402c77f9c7d751c627db36885e12aaff62bf9</url>
  <id>516402c77f9c7d751c627db36885e12aaff62bf9</id>
  <committed-date>2009-04-20T14:48:34-07:00</committed-date>
  <authored-date>2009-04-20T09:52:43-07:00</authored-date>
  <message>Fixing #1918 - facter --puppet always works

The problem was that Facter wasn't telling Puppet to read
your puppet.conf, so if you'd set vardir or libdir
in it then you didn't get the appropriate settings and thus
not know where to find the facter plugins.

This is a bit of a ham-handed approach, but it always works.

Signed-off-by: Luke Kanies &lt;luke@madstop.com&gt;</message>
  <tree>b14e85124a3a599a478ba4046076d4e84aadabb1</tree>
  <committer>
    <name>Luke Kanies</name>
    <email>luke@madstop.com</email>
  </committer>
</commit>
