hi all, I have an array and i would like to convert it into a string format. e.g. $server = ["node1", "node2", "node3"] when I write my puppet codes exec { "myscript -S $server": path => XXXX } my $server becomes a continual string like: "node1node2node3", instead of "node1 node2 node3". How can i have a delimiter of space in between the array item? thanks! -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/OdJUlKWcv9wJ. 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.
Hi, you can use inline_template, this way you can incorperate ruby code in your manifest $server_string = inline_template("<% server.join('' '') %>") see http://docs.puppetlabs.com/references/latest/function.html#inlinetemplate hope this helps Grts Jo On 10/29/2012 09:29 AM, Hiu wrote:> hi all, > > I have an array and i would like to convert it into a string format. > > e.g. > > $server = ["node1", "node2", "node3"] > > when I write my puppet codes > > exec { "myscript -S $server": > path => XXXX > } > > my $server becomes a continual string like: "node1node2node3", instead > of "node1 node2 node3". How can i have a delimiter of space in between > the array item? > > thanks! > -- > You received this message because you are subscribed to the Google > Groups "Puppet Users" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/puppet-users/-/OdJUlKWcv9wJ. > 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.-- Johan De Wit Open Source Consultant Red Hat Certified Engineer (805008667232363) Puppet Certified Professional 2013 (PCP0000006) _________________________________________________________ Open-Future Phone +32 (0)2/255 70 70 Zavelstraat 72 Fax +32 (0)2/255 70 71 3071 KORTENBERG Mobile +32 (0)474/42 40 73 BELGIUM http://www.open-future.be _________________________________________________________ -- 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.
or use the join() function from puppetlabs-stdlib module. -- Erik Dalén On Monday 29 October 2012 at 05:08, Johan De Wit wrote:> Hi, > > you can use inline_template, this way you can incorperate ruby code in > your manifest > > $server_string = inline_template("<% server.join('' '') %>") > > see > http://docs.puppetlabs.com/references/latest/function.html#inlinetemplate > > hope this helps > > Grts > > Jo > > On 10/29/2012 09:29 AM, Hiu wrote: > > hi all, > > > > I have an array and i would like to convert it into a string format. > > > > e.g. > > > > $server = ["node1", "node2", "node3"] > > > > when I write my puppet codes > > > > exec { "myscript -S $server": > > path => XXXX > > } > > > > my $server becomes a continual string like: "node1node2node3", instead > > of "node1 node2 node3". How can i have a delimiter of space in between > > the array item? > > > > thanks! > > -- > > You received this message because you are subscribed to the Google > > Groups "Puppet Users" group. > > To view this discussion on the web visit > > https://groups.google.com/d/msg/puppet-users/-/OdJUlKWcv9wJ. > > To post to this group, send email to puppet-users@googlegroups.com (mailto:puppet-users@googlegroups.com). > > To unsubscribe from this group, send email to > > puppet-users+unsubscribe@googlegroups.com (mailto:puppet-users+unsubscribe@googlegroups.com). > > For more options, visit this group at > > http://groups.google.com/group/puppet-users?hl=en. > > > > > -- > Johan De Wit > > Open Source Consultant > Red Hat Certified Engineer (805008667232363) > Puppet Certified Professional 2013 (PCP0000006) > _________________________________________________________ > > Open-Future Phone +32 (0)2/255 70 70 > Zavelstraat 72 Fax +32 (0)2/255 70 71 > 3071 KORTENBERG Mobile +32 (0)474/42 40 73 > BELGIUM http://www.open-future.be > _________________________________________________________ > > -- > 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 (mailto:puppet-users@googlegroups.com). > To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com (mailto:puppet-users+unsubscribe@googlegroups.com). > For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.-- 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.