class Chef::Provider::Template::Content

Public Instance Methods

template_location() click to toggle source
# File lib/chef/provider/template/content.rb, line 30
def template_location
  @template_file_cache_location ||= begin
    template_finder.find(@new_resource.source, :local => @new_resource.local, :cookbook => @new_resource.cookbook)
  end
end

Private Instance Methods

file_for_provider() click to toggle source
# File lib/chef/provider/template/content.rb, line 38
def file_for_provider
  context = TemplateContext.new(@new_resource.variables)
  context[:node] = @run_context.node
  context[:template_finder] = template_finder
  context._extend_modules(@new_resource.helper_modules)
  output = context.render_template(template_location)

  tempfile = Tempfile.open("chef-rendered-template")
  tempfile.binmode
  tempfile.write(output)
  tempfile.close
  tempfile
end
template_finder() click to toggle source
# File lib/chef/provider/template/content.rb, line 52
def template_finder
  @template_finder ||= begin
    TemplateFinder.new(run_context, @new_resource.cookbook_name, @run_context.node)
  end
end