Issue #4549 has been updated by Matt Robinson.

Status changed from Needs Decision to Merged - Pending Release
Assignee deleted (Nigel Kersten)

I talked to Nigel, and he's good on this fix, so it's merged 
4f873f0ea8bc259b7ecd4f4a9920decad3339656
----------------------------------------
Bug #4549: not all puppet functions are available in the template scope
https://projects.puppetlabs.com/issues/4549

Author: Peter Meier
Status: Merged - Pending Release
Priority: Normal
Assignee: 
Category: 
Target version: 2.7.x
Affected Puppet version: 0.25.5
Keywords: 
Branch: 
https://github.com/mmrobins/puppet/tree/ticket/2.7.x/4549-functions_in_templates


I was looking for a way to call puppet function in templates (for example to 
evaluate a template in a template). According to 
http://serverfault.com/questions/34642/call-puppet-function-from-puppet-template
 it looks like this is possible. However it does not seem to work for all 
functions:

<pre>
# cat foo.pp 
$a = inline_template("<%= scope.methods.select{|meth| meth =~ /^function_/ 
}.sort.join('\n')  %>")
notice $a
# puppet foo.pp 
notice: Scope(Class[main]): function_alert
function_crit
function_debug
function_emerg
function_err
function_info
function_inline_template
function_notice
function_warning
#
</pre>

There was also a report about that on the users list with no answer: 
http://groups.google.com/group/puppet-users/browse_thread/thread/59a7ee977b26fc3d

In general we can ask: Is it the idea that puppet functions are available in 
templates?

If no, why is the inline_template function available? Besides that I think 
functions in general should be available.
If yes, where are the missing functions and how can we call them?

Looking at the code doesn't reveal how inline_teplate might be added in a 
special way to the scope, also it seems that the function creation code should 
register the functions and at least for the tests they seem to be registered.


-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-bugs?hl=en.

Reply via email to