Issue #4915 has been reported by Jordan Sissel.
----------------------------------------
Bug #4915: scope.function_extlookup (in templates) requires additional step to
work
http://projects.puppetlabs.com/issues/4915
Author: Jordan Sissel
Status: Unreviewed
Priority: Normal
Assignee:
Category:
Target version:
Affected version:
Keywords:
Branch:
This does not work
<pre>
notice(
inline_template("<%= scope.function_extlookup('hello world') %>")
)
Error:
Failed to parse inline template: undefined method `function_extlookup' for
#<Puppet::Parser::Scope:0x7f9df63a0b38> at /home/jls/f.pp:2 on node snack.home
</pre>
Someone on IRC pointed out needing to invoke this:
Puppet::Parser::Functions.autoloader.loadall
Following this instruction, it seems to be the right direction, but still does
not work:
<pre>
notice(
inline_template("<%= Puppet::Parser::Functions.autoloader.loadall;
scope.function_extlookup('hello world') %>")
)
Error:
Failed to parse inline template: extlookup(): wrong number of arguments (11;
must be <= 3) at /home/jls/f.pp:2 on node snack.home
</pre>
Volcane pointed out that extlookup() expects an array, which made the '11'
above pretty obvious as 'hello world'.size == 11.
This version works:
<pre>
notice(
inline_template("<%= Puppet::Parser::Functions.autoloader.loadall;
scope.function_extlookup(['hello world']) %>")
)
Output:
notice: Scope(Class[main]): Hello sir!
</pre>
---
Two unexpected things. First, that I have to call the extra function loader.
Second, that extlookup in templates requires an array.
Possible fixes: Make extlookup available always. Also, make extlookup check if
the type given is a string, and if so, treat it normally.
Thoughts?
--
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.