Randall Hansen
2011-May-20  20:15 UTC
[Puppet Users] PC EU feedback: unpack array variables in string interpolation
http://projects.puppetlabs.com/issues/7598
If your goal is this (pseudo-code):
    @file { "host_one" }
    @file { "host_two" }
You should be able to say this:
    $array = [ "one", "two" ]
    @file { "host_$array" }
Instead of this:
    @file { "host_one", "host_two" }
Please comment on the ticket or reply here, whichever you prefer.
Thanks!
r
P.S. This is in response to feedback from my "Improving the Puppet
DSL" session at Puppet Camp EU, 2011.  This ticket isn''t a promise
we
will take action, but we could very much like comment and discussion
from you good people.
-- 
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to
puppet-users+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.
vagn scott
2011-May-25  01:54 UTC
Re: [Puppet Users] PC EU feedback: unpack array variables in string interpolation
What should this do?
     $array = [ "one", "two" ]
     $greeting = [ "hello", "howdy" ]
     @file { "host_$array$greeting" }
or this?
     $array = [ "one", "two" ]
     @file { "$array_blah" }
seems like we would need delimiters
     "host_${array}_${greeting}"
and some form of expansion control.
Should it expand zipper-wise or combinatorially?
Probably all of that belongs in functions,
not in the resource or string syntax.
-- 
vagn
On 05/20/2011 04:15 PM, Randall Hansen wrote:> http://projects.puppetlabs.com/issues/7598
>
> If your goal is this (pseudo-code):
>
>      @file { "host_one" }
>      @file { "host_two" }
>
> You should be able to say this:
>
>      $array = [ "one", "two" ]
>      @file { "host_$array" }
>
> Instead of this:
>
>      @file { "host_one", "host_two" }
>
> Please comment on the ticket or reply here, whichever you prefer.
>
> Thanks!
>
> r
>
> P.S. This is in response to feedback from my "Improving the Puppet
> DSL" session at Puppet Camp EU, 2011.  This ticket isn''t a
promise we
> will take action, but we could very much like comment and discussion
> from you good people.
>
>    
-- 
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to
puppet-users+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.
jcbollinger
2011-May-25  12:44 UTC
[Puppet Users] Re: PC EU feedback: unpack array variables in string interpolation
On May 24, 8:54 pm, vagn scott <vagnsc...@gmail.com> wrote:> What should this do? > > $array = [ "one", "two" ] > $greeting = [ "hello", "howdy" ] > @file { "host_$array$greeting" } > > or this? > > $array = [ "one", "two" ] > @file { "$array_blah" } > > seems like we would need delimiters > > "host_${array}_${greeting}" > > and some form of expansion control. > Should it expand zipper-wise or combinatorially? > > Probably all of that belongs in functions, > not in the resource or string syntax.+1 Moreover, consider the juxtaposition of this proposal with those that seek to make the language less idiosyncratic and "magical". This one proposes a move in the opposite direction. John -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.