diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/chef/provider/template_finder.rb | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/lib/chef/provider/template_finder.rb b/lib/chef/provider/template_finder.rb index 3c402f6aae..e1662a88f1 100644 --- a/lib/chef/provider/template_finder.rb +++ b/lib/chef/provider/template_finder.rb @@ -29,15 +29,31 @@ class Chef def find(template_name, options = {}) if options[:local] - return options[:source] ? options[:source] : template_name + return local_template_source(template_name, options) end - cookbook_name = options[:cookbook] ? options[:cookbook] : @cookbook_name - + cookbook_name = find_cookbook_name(options) cookbook = @run_context.cookbook_collection[cookbook_name] cookbook.preferred_filename_on_disk_location(@node, :templates, template_name) end + + protected + def local_template_source(name, options) + if options[:source] + options[:source] + else + name + end + end + + def find_cookbook_name(options) + if options[:cookbook] + options[:cookbook] + else + @cookbook_name + end + end end end end |