[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, master, updated. debian/0.24.6-1-356-g5718585

James Turnbull james at lovedthanlost.net
Fri Jan 23 14:20:57 UTC 2009


The following commit has been merged in the master branch:
commit 09057346dd7207e36c81bae479d1343fb7cc8d0a
Author: Thom May <thom at joost.com>
Date:   Tue Sep 16 10:24:18 2008 +0100

    Allow a templatedir to be colon separated.
    
    Signed-off-by: Thom May <thom at clearairturbulence.org>
    Signed-off-by: Paul Nasrat <pnasrat at googlemail.com>

diff --git a/lib/puppet/module.rb b/lib/puppet/module.rb
index 544d94e..4bdfab0 100644
--- a/lib/puppet/module.rb
+++ b/lib/puppet/module.rb
@@ -19,6 +19,15 @@ class Puppet::Module
         end
     end
 
+    # Return an array of paths by splitting the +templatedir+ config
+    # parameter.
+    def self.templatepath(environment = nil)
+        dirs = Puppet.settings.value(:templatedir, environment).split(":")
+        dirs.select do |p|
+            p =~ /^#{File::SEPARATOR}/ && File::directory?(p)
+        end
+    end
+
     # Find and return the +module+ that +path+ belongs to. If +path+ is
     # absolute, or if there is no module whose name is the first component
     # of +path+, return +nil+
@@ -64,9 +73,12 @@ class Puppet::Module
         end
 
         # If we can find the template in :templatedir, we return that.
-        td_file = File.join(Puppet.settings.value(:templatedir, environment), template)
-        return td_file if File.exists?(td_file)
-          
+        td_file = templatepath(environment).collect { |path|
+            File::join(path, template)
+        }.find { |f| File.exists?(f) }
+
+        return td_file unless td_file == nil
+
         path, file = split_path(template)
 
         # Because templates don't have an assumed template name, like manifests do,

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list