Class: Chef::Provider::TemplateFinder

Inherits:
Object
  • Object
show all
Defined in:
lib/chef/provider/template_finder.rb

Instance Method Summary collapse

Constructor Details

#initialize(run_context, cookbook_name, node) ⇒ TemplateFinder

Returns a new instance of TemplateFinder.



24
25
26
27
28
# File 'lib/chef/provider/template_finder.rb', line 24

def initialize(run_context, cookbook_name, node)
  @run_context = run_context
  @cookbook_name = cookbook_name
  @node = node
end

Instance Method Details

#find(template_name, options = {}) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/chef/provider/template_finder.rb', line 30

def find(template_name, options = {})
  template_name = template_source_name(template_name, options)

  if options[:local]
    return template_name
  end

  cookbook_name = find_cookbook_name(options)
  cookbook = @run_context.cookbook_collection[cookbook_name]

  cookbook.preferred_filename_on_disk_location(@node, :templates, template_name)
end