[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, master, updated. 90c4a6028cf6ebd530af736ce08f1b413698b162

Micah Anderson micah at riseup.net
Sat May 31 17:15:33 UTC 2008


The following commit has been merged in the master branch:
commit b39a436380218a2895c34547ba4c20c59f496bd7
Author: Luke Kanies <luke at madstop.com>
Date:   Fri May 16 15:42:20 2008 -0500

    Modified the 'factpath' setting to automatically configure
    Facter to load facts there if a new enough version of
    Facter is used.

diff --git a/CHANGELOG b/CHANGELOG
index 870afb9..612eb34 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,15 +1,11 @@
-    Moving all confine code out of the Provider class, and fixing #1197. 
-    Created a Confiner module for the Provider class methods, enhanced 
-    the interface between it and the Confine class to make sure binary 
-    paths are searched for fresh each time.
-
-    Crontab provider: fix a parse error when a line begins with a space 
-    character (fixes #1216)
-
     Instead of deleting the init scripts (with --del) we should simply 
     disable it with chkconfig service off, and respectfully do the same 
     for enable => true;
  
+    Modified the 'factpath' setting to automatically configure
+    Facter to load facts there if a new enough version of
+    Facter is used.
+
     Added ldap providers for users and groups.
 
     Added support for the --all option to puppetca --clean.  If
diff --git a/lib/puppet/defaults.rb b/lib/puppet/defaults.rb
index 0f01c2e..f6468e6 100644
--- a/lib/puppet/defaults.rb
+++ b/lib/puppet/defaults.rb
@@ -505,9 +505,11 @@ module Puppet
 
     # Central fact information.
     self.setdefaults(:main,
-        :factpath => ["$vardir/facts",
-            "Where Puppet should look for facts.  Multiple directories should
-            be colon-separated, like normal PATH variables."],
+        :factpath => {:default => "$vardir/facts",
+            :desc => "Where Puppet should look for facts.  Multiple directories should
+                be colon-separated, like normal PATH variables.",
+            :call_on_define => true, # Call our hook with the default value, so we always get the value added to facter.
+            :hook => proc { |value| Facter.search(value) if Facter.respond_to?(:search) }},
         :factdest => ["$vardir/facts",
             "Where Puppet should store facts that it pulls down from the central
             server."],
diff --git a/spec/integration/defaults.rb b/spec/integration/defaults.rb
new file mode 100755
index 0000000..b14a141
--- /dev/null
+++ b/spec/integration/defaults.rb
@@ -0,0 +1,17 @@
+#!/usr/bin/env ruby
+
+require File.dirname(__FILE__) + '/../spec_helper'
+
+require 'puppet/defaults'
+
+describe "Puppet defaults" do
+    describe "when setting the :factpath" do
+        after { Puppet.settings.clear }
+
+        it "should add the :factpath to Facter's search paths" do
+            Facter.expects(:search).with("/my/fact/path")
+
+            Puppet.settings[:factpath] = "/my/fact/path"
+        end
+    end
+end

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list