summaryrefslogtreecommitdiffstats
path: root/lib/puppet/module.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/puppet/module.rb')
-rw-r--r--lib/puppet/module.rb20
1 files changed, 14 insertions, 6 deletions
diff --git a/lib/puppet/module.rb b/lib/puppet/module.rb
index 34b13edb7..924958bbe 100644
--- a/lib/puppet/module.rb
+++ b/lib/puppet/module.rb
@@ -43,17 +43,25 @@ class Puppet::Module
# param.
# In all cases, an absolute path is returned, which does not
# necessarily refer to an existing file
- def self.find_template(file, environment = nil)
- if file =~ /^#{File::SEPARATOR}/
- return file
+ def self.find_template(template, environment = nil)
+ if template =~ /^#{File::SEPARATOR}/
+ return template
end
- path, file = split_path(file)
- mod = find(path, environment)
+ path, file = split_path(template)
+
+ # Because templates don't have an assumed template name, like manifests do,
+ # we treat templates with no name as being templates in the main template
+ # directory.
+ if file.nil?
+ mod = nil
+ else
+ mod = find(path, environment)
+ end
if mod
return mod.template(file)
else
- return File.join(Puppet.config.value(:templatedir, environment), path, file)
+ return File.join(Puppet.config.value(:templatedir, environment), template)
end
end