summaryrefslogtreecommitdiffstats
path: root/lib/puppet
diff options
context:
space:
mode:
authorBrice Figureau <brice-puppet@daysofwonder.com>2008-10-05 17:11:22 +0200
committerJames Turnbull <james@lovedthanlost.net>2008-10-08 11:40:18 +1100
commit253d4df1f49e1516a111557b98b29509c39b41e0 (patch)
tree399c150b0f3b37bd56eaef7ae35a8b832754c322 /lib/puppet
parentc7a6ef2889b0fb2507e5be98a1dd29b69957a216 (diff)
downloadpuppet-253d4df1f49e1516a111557b98b29509c39b41e0.tar.gz
puppet-253d4df1f49e1516a111557b98b29509c39b41e0.tar.xz
puppet-253d4df1f49e1516a111557b98b29509c39b41e0.zip
Fix regression when templatedir doesn't exist.
When searching for a module template and if the default templatedir is inexistant, puppet was raising an error without trying the modules templates directories. Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
Diffstat (limited to 'lib/puppet')
-rw-r--r--lib/puppet/module.rb22
1 files changed, 14 insertions, 8 deletions
diff --git a/lib/puppet/module.rb b/lib/puppet/module.rb
index b34f2f8b0..9385812b1 100644
--- a/lib/puppet/module.rb
+++ b/lib/puppet/module.rb
@@ -73,17 +73,23 @@ class Puppet::Module
end
template_paths = templatepath(environment)
- default_template_path = File::join(template_paths.first, template)
+ if template_paths
+ # If we can find the template in :templatedir, we return that.
+ td_file = template_paths.collect { |path|
+ File::join(path, template)
+ }.find { |f| File.exists?(f) }
- # If we can find the template in :templatedir, we return that.
- td_file = template_paths.collect { |path|
- File::join(path, template)
- }.find { |f| File.exists?(f) }
-
- return td_file unless td_file == nil
+ return td_file unless td_file == nil
+ end
td_file = find_template_for_module(template, environment)
- td_file ||= default_template_path
+
+ # check in the default template dir, if there is one
+ if td_file.nil?
+ raise Puppet::Error, "No valid template directory found, please check templatedir settings" if template_paths.nil?
+ td_file = File::join(template_paths.first, template)
+ end
+ td_file
end
def self.find_template_for_module(template, environment = nil)