diff options
author | Luke Kanies <luke@madstop.com> | 2009-05-17 23:08:40 -0500 |
---|---|---|
committer | James Turnbull <james@lovedthanlost.net> | 2009-05-18 17:05:26 +1000 |
commit | 07ff4be92a1d46fe0f6ec3de3c33b5a3b99be755 (patch) | |
tree | b6337cf6ee22b7e0ace0d1b3a635f1fdacd5fd68 /lib/puppet/parser/files.rb | |
parent | 7ce42daf5a0c2e3946732f7acb1c0ce680dc432e (diff) | |
download | puppet-07ff4be92a1d46fe0f6ec3de3c33b5a3b99be755.tar.gz puppet-07ff4be92a1d46fe0f6ec3de3c33b5a3b99be755.tar.xz puppet-07ff4be92a1d46fe0f6ec3de3c33b5a3b99be755.zip |
Fixing #2250 - Missing templates throw a helpful error
This changes the behaviour of template searching a bit -
we previously usually returned a file name, whether the template
existed or not. Now we only return a path if it
exists.
Refactoring a few of the the tests for TemplateWrapper, also.
Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'lib/puppet/parser/files.rb')
-rw-r--r-- | lib/puppet/parser/files.rb | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/puppet/parser/files.rb b/lib/puppet/parser/files.rb index ca4fb4f10..749428e9f 100644 --- a/lib/puppet/parser/files.rb +++ b/lib/puppet/parser/files.rb @@ -41,7 +41,7 @@ module Puppet::Parser::Files if template_paths = templatepath(environment) # If we can find the template in :templatedir, we return that. - td_file = template_paths.collect { |path| + template_paths.collect { |path| File::join(path, template) }.each do |f| return f if FileTest.exist?(f) @@ -49,11 +49,11 @@ module Puppet::Parser::Files end # check in the default template dir, if there is one - unless td_file = find_template_in_module(template, environment) - raise Puppet::Error, "No valid template directory found, please check templatedir settings" if template_paths.nil? - td_file = File::join(template_paths.first, template) + if td_file = find_template_in_module(template, environment) + return td_file end - td_file + + return nil end def find_template_in_module(template, environment = nil) |