Custom functions from a template?

103 views
Skip to first unread message

Joshua Barratt

unread,
Nov 6, 2009, 12:50:00 PM11/6/09
to puppet...@googlegroups.com
Hi all,

I have things working such that I can call

#init.pp
$myvar = my_custom_func("arguments")

file { "/tmp/foo":
    content => template("mymodule/test_template.erb")
}

# test_template.erb
<%= myvar %>

And all is well.

However, I'd ideally like to say:

#init.pp
$myvar = "some_key_value"
file { "/tmp/foo":
    content => template("mymodule/test_template.erb")
}

# test_template.erb
<%= my_custom_func($myvar) %>

I found this:

Which showed how to call 'puppet core functions', like
<%= scope.function_template("mymodule/othertemplate.erb") %>

which is kind of cool, but.... scope.function_mycustomfunction doesn't seem to work.

Any magical invocation that will make it work?

Thanks,

Josh
Reply all
Reply to author
Forward
0 new messages