Issue #20731 has been reported by James Shubin.

----------------------------------------
Bug #20731: Exported resources transform an array of length 1 into a string
https://projects.puppetlabs.com/issues/20731

* Author: James Shubin
* Status: Unreviewed
* Priority: High
* Assignee: 
* Category: 
* Target version: 
* Affected Puppet version: 
* Keywords: 
* Branch: 
----------------------------------------
<pre>
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.
<code>
        $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',
        }
</code>

* I noticed the problem because on my destination I saw:

<code>
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
</code>

The template contains:
<code>
<%= servers.join(' ') %>
</code>

And the ::export function contains:

<code>
define foo::bar::export(
        $servers = [],
) {
        # helper function to make it easy to use class as an exported resource!
        class { '::something::else':
                servers => $servers,
        }
}
</code>

and the class contains:

<code>
        file { '/tmp/whatever':
                content => template('foox/blah.erb'),
        }
</code>

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!

</pre>


-- 
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.


Reply via email to