Issue #15756 has been updated by Josh Cooper.
Status changed from Unreviewed to Accepted
Assignee set to eric sorenson
Target version set to 3.x
Some functions correctly handle being called with either a string or array,
e.g. `defined`.
<pre>
vals = [vals] unless vals.is_a?(Array)
vals.each do |val|
</pre>
Others do not, and will need to be fixed for ruby19 support. At quick glance
these look suspect:
<pre>
file
inline_template
md5
regsubst
search
sha1
shellquote
sprintf
tagged
template
</pre>
Also, the `include` function flattens arrays, which none of the other functions
do.
Since ruby19 is not officially supported in 2.7.x
<http://docs.puppetlabs.com/guides/platforms.html#ruby-versions> I'm targeting
this at 3.x. Eric, should this be for telly?
----------------------------------------
Bug #15756: scope.function_template with a single String parameter fails in
Ruby 1.9
https://projects.puppetlabs.com/issues/15756#change-69113
Author: Roger Que
Status: Accepted
Priority: Normal
Assignee: eric sorenson
Category: templates
Target version: 3.x
Affected Puppet version: 2.7.18
Keywords: ruby19
Branch:
The Puppet documentation mentions [using `scope.function_template` with a
String
parameter](http://docs.puppetlabs.com/guides/templating.html#access-to-variables-and-puppet-functions-with-the-scope-object)
in order to render an ERB template inside another template:
<%= scope.function_template('referenced_template.erb') %>
This works in Ruby 1.8, but fails with the following error when the Puppet
master is running 1.9:
err: Could not retrieve catalog from remote server: Error 400 on SERVER:
Failed to parse template [xxx].erb:
Filepath: /usr/share/ruby/vendor_ruby/puppet/parser/functions/template.rb
Line: 10
Detail: undefined method `collect' for "referenced_template.erb":String
at /etc/puppet/modules/[yyy].pp:164 on node [zzz.example]
It looks like the `template` function is invoking `collect` on its argument
regardless of whether it's a String or Array, which works in Ruby 1.8
(`'abc'.collect` behaves like `['abc'].collect`) but not in 1.9. Passing an
Array works with both versions.
This is on Fedora 17, Ruby 1.9.3p194, with Puppet 2.7.18.
--
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.