I'm trying to include a subtemplate in a template for one of my Puppet modules. Here's how I do the include in my base template:
<%
def import(fname)
erb =
File.open(File.dirname(__FILE__) + "/" + fname) { |fp| ERB.new(fp.read) }
erb.run
end
%>
<%= import("subtemplate.erb") %>
This works fine if I render it with erb command-line tool. However, during the Puppet run the import is silently ignored, i.e. the base template is rendered with a blank line where the rendered subtemplate should be. There are no errors generated.
What am I doing wrong? Thanks!