example.pp
$foo = 'bar'
$content = template('mymodule/maintemplate.erb')
maintemplate.erb
<% bar = foo + "extra" %>
foobar = scope_function_template(['mymodule/subtemplate.erb'])
subtemplate.erb
<%# here i want to access the variable bar %>
<%= bar %>
there is the function
<%= scope.lookupvar('::bar') %>
is there a kind of parent::bar
in erb templateing, or can i pass some variables to the subtemplate, or can i only access the outer variable (of the .pp file) with ::foo
Best Answer
As stated in this bugreport/feature request: http://projects.puppetlabs.com/issues/6492 there is a workaround using
scope.setvar
This is ugly but seems to work...