summaryrefslogtreecommitdiffstats
path: root/lib/puppet/module.rb
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2007-08-25 17:14:13 -0500
committerLuke Kanies <luke@madstop.com>2007-08-25 17:14:13 -0500
commit9df4fd1f2188c90190e33e165206e7931938607b (patch)
tree071a42fa559ffd800a4d0e586a8bd05f0e31f3a1 /lib/puppet/module.rb
parentba3a861af2e5c30fd9bbbe0e1666fa316139113b (diff)
downloadpuppet-9df4fd1f2188c90190e33e165206e7931938607b.tar.gz
puppet-9df4fd1f2188c90190e33e165206e7931938607b.tar.xz
puppet-9df4fd1f2188c90190e33e165206e7931938607b.zip
And we have multiple environment support in the parser. The only remaining piece to make this complete is to add multiple environment support to the fileserver. I also renamed Configuration.rb to Compile.rb (that is, I fixed all the classes that used to know it as a configuration).
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