Issue #20731 has been updated by Charlie Sharpsteen. Description updated Status changed from Unreviewed to Duplicate Assignee set to Charlie Sharpsteen
Please don't wrap your issue descriptions in <pre\> tags---this makes the resulting description very hard to read as everything gets crammed into a small box without line wrapping that requires horizontal scrolling. Use <pre\> to enclose code snippets or console output. As to what is going on here, the puppet parser automatically unwraps single-element arrays as explained in #15813. This is definitely a behavior we want to do away with, but also the sort of change that is difficult to execute without subtly breaking existing behaviors that people are depending on. Marking as a duplicate of #15813. ---------------------------------------- Bug #20731: Exported resources transform an array of length 1 into a string https://projects.puppetlabs.com/issues/20731#change-91055 * Author: James Shubin * Status: Duplicate * Priority: High * Assignee: Charlie Sharpsteen * Category: * Target version: * Affected Puppet version: * Keywords: * Branch: ---------------------------------------- This is very weird puppet! * If I specify either of the single element (thing1, thing2) arrays, then, on the collecting side, i see a single "string". * If I specify an array of 2 or more elements (thing3) it works fine. <pre> $thing = '192.168.123.6' @@foo::bar::export { 'somename': #servers => [$thing], # thing1 fails! #servers => ["${thing}"], # thing2 fails! servers => ["this", 'is', 'abug'], # thing3 works! tag => 'dhcp', } </pre> * I noticed the problem because on my destination I saw: <pre> Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Failed to parse template foo/blah.erb: Filepath: [snip]/blah.erb Line: 10 Detail: undefined method `join' for "192.168.123.6":String at whatever.pp:324 on node node.example.com Warning: Not using cache on failed catalog Error: Could not retrieve catalog; skipping run </pre> The template contains: <pre> <%= servers.join(' ') %> </pre> And the ::export function contains: <pre> define foo::bar::export( $servers = [], ) { # helper function to make it easy to use class as an exported resource! class { '::something::else': servers => $servers, } } </pre> and the class contains: <pre> file { '/tmp/whatever': content => template('foox/blah.erb'), } </pre> Some names were changed to protect the innocent! Sorry if there's a little inconsistency, but it should be pretty obvious to see what's going on. I'm using the yum.puppetlabs... latest puppet3. Hrm, cheers! -- 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 unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/puppet-bugs?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
