How to access variables in an erb-subtemplate in puppet?
- by c33s
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