Issue #11967 has been updated by Steve Shipway.
I think it should be possible to use the same semantics, split($variable), but
allow $variable to be either a string or an array.
If passed an array, all the members are split, and the resulting arrays
concatenated.
IE:
$vara = 'a.b.c'
$varb = [ 'a.b', 'c', 'd.e.f' ]
$splita = split($vara,"[.]")
$splitb = split($varb,"[.]")
# After this, the variables hold:
#$splita = [ 'a', 'b', 'c' ]
#$splitb = [ 'a', 'b', 'c', 'd', 'e', 'f' ]
I'd also like to see a join() function added to the puppet language to balance
the split() function, but that's a separate issue.
----------------------------------------
Feature #11967: split() function does not work on array variables
https://projects.puppetlabs.com/issues/11967
Author: Steve Shipway
Status: Needs More Information
Priority: Normal
Assignee: Steve Shipway
Category: functions
Target version:
Affected Puppet version: 2.7.6
Keywords: split
Branch:
The split() function results in an error message if the first parameter is an
array.
While this usage may not have been originally intended, it would be very useful
for it to handle this case as we are using split() to handle the return value
of extlookup which can be either a string or an array.
EG:
$avar = [ 'a.b', 'c', 'd.e' ]
$b = split( $avar, '[.]' )
Currently results in error, but would be better if it resulted in $b = [ 'a',
'b', 'c', 'd', 'e' ]
--
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.