Issue #15756 has been updated by Andrew  Parker.

Status changed from Accepted to In Topic Branch Pending Review
Branch set to https://github.com/puppetlabs/puppet/pull/1105

https://github.com/puppetlabs/puppet/pull/1105
----------------------------------------
Bug #15756: scope.function_template with a single String parameter fails in 
Ruby 1.9
https://projects.puppetlabs.com/issues/15756#change-70509

Author: Roger Que
Status: In Topic Branch Pending Review
Priority: Normal
Assignee: Andrew  Parker
Category: templates
Target version: 3.0.0
Affected Puppet version: 2.7.18
Keywords: ruby19 functions
Branch: https://github.com/puppetlabs/puppet/pull/1105


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.

Reply via email to