summaryrefslogtreecommitdiffstats
path: root/lib/puppet/module.rb
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2008-10-17 09:01:04 -0500
committerLuke Kanies <luke@madstop.com>2008-10-17 09:01:04 -0500
commit8aee40de69e6fe8d67ab58a2e223443b15820584 (patch)
tree89e230df3b43302a542f2cb6869f63e2fb93f6d8 /lib/puppet/module.rb
parent1b517d2fb048603bd1743a662bde74e8ae4b13dc (diff)
parenta74ec60d33dee1c592ec858faeccc23d7a7b79f3 (diff)
downloadpuppet-8aee40de69e6fe8d67ab58a2e223443b15820584.tar.gz
puppet-8aee40de69e6fe8d67ab58a2e223443b15820584.tar.xz
puppet-8aee40de69e6fe8d67ab58a2e223443b15820584.zip
Merge branch '0.24.x' Removed the 'after' blocks that call Type.clear,
since that method is deprecated. Conflicts: CHANGELOG bin/puppetca lib/puppet/file_serving/fileset.rb lib/puppet/network/xmlrpc/client.rb lib/puppet/type/file/selcontext.rb spec/unit/file_serving/metadata.rb spec/unit/type/file.rb
Diffstat (limited to 'lib/puppet/module.rb')
-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)