Hi all, I''ve a silly problem that it''s driving me crazy and I''m almost sure the solution is quick and easy. Still it doesn''t seem at my reach. I''ve a variable with an array of values, such as: users_ldap_servers = [ "ldapm.example42.com" , "ldaps.example42.com" ] I want to use these values in a single line of a template: host <% users_ldap_servers.each do |ldap| %> <%= ldap %> <% end %> No matter how many spaces I place around, no matter the absence of trimming -%> I always get something like: host ldapm.example42.comldaps.example42.com instead of: host ldapm.example42.com ldaps.example42.com I think a solution could be to add a whitespace to "ldap" before yielding it... but I haven''t found the needed "few chars combo" (I suppose). Any help? Al -- 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.
Hi Al, seems like its been a while :) On Fri, Sep 10, 2010 at 5:50 AM, Al @ Lab42 <lab42.it@gmail.com> wrote:> Hi all, > I''ve a silly problem that it''s driving me crazy and I''m almost sure > the solution is quick and easy. > Still it doesn''t seem at my reach. > > I''ve a variable with an array of values, such as: > users_ldap_servers = [ "ldapm.example42.com" , "ldaps.example42.com" ] > > I want to use these values in a single line of a template: > > host <% users_ldap_servers.each do |ldap| %> <%= ldap %> <% end %> > >that''s weird, it should not ignore your white spaces. I just tried: array<% array.each do |a| %> <%= a %><% end %> you could always use <%= "#{ldap} " %> as a last resort (although the above should work)> No matter how many spaces I place around, no matter the absence of > trimming -%> I always get something like: > > host ldapm.example42.comldaps.example42.com > instead of: > host ldapm.example42.com ldaps.example42.com > > I think a solution could be to add a whitespace to "ldap" before > yielding it... but I haven''t found the needed "few chars combo" (I > suppose). > > Any help? > Al > > -- > 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<puppet-users%2Bunsubscribe@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.
Am 10.09.2010 um 14:50 schrieb Al @ Lab42:> I want to use these values in a single line of a template: > > host <% users_ldap_servers.each do |ldap| %> <%= ldap %> <% end %> > > No matter how many spaces I place around, no matter the absence of > trimming -%> I always get something like: > > host ldapm.example42.comldaps.example42.com > instead of: > host ldapm.example42.com ldaps.example42.com > > I think a solution could be to add a whitespace to "ldap" before > yielding it... but I haven''t found the needed "few chars combo" (I > suppose).Try <%= ldap + " " %>, or even force ldap to a string (ldap.to_s) if it complains about not being able to add " " to a not-String. Felix -- 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.
On Sep 10, 2:57 pm, Dan Bode <d...@puppetlabs.com> wrote:> Hi Al, > > seems like its been a while :)HI Dan, yes indeed. But this time I should be more present. I''ve finally found a job where I can actively work with Puppet, so I expect to pass much more time around here.> On Fri, Sep 10, 2010 at 5:50 AM, Al @ Lab42 <lab42...@gmail.com> wrote: > > > Hi all, > > I''ve a silly problem that it''s driving me crazy and I''m almost sure > > the solution is quick and easy. > > Still it doesn''t seem at my reach. > > > I''ve a variable with an array of values, such as: > > users_ldap_servers = [ "ldapm.example42.com" , "ldaps.example42.com" ] > > > I want to use these values in a single line of a template: > > > host <% users_ldap_servers.each do |ldap| %> <%= ldap %> <% end %> > > that''s weird, it should not ignore your white spaces. > > I just tried: > > array<% array.each do |a| %> <%= a %><% end %> > > you could always use > > <%= "#{ldap} " %> > > as a last resort (although the above should work)It''s weird also for me, but still I don''t get the expected result. Also with your suggestion... Thanks anyway Al -- 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.
> It''s weird also for me, but still I don''t get the expected result. > Also with your suggestion...I found the problem. It''s somehow my fault. In the way I manage variables. Now I''ve a totally different problem with my approach to set variables defaults, but that''s another story... Thanks again Al -- 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.
> Try <%= ldap + " " %>, or even force ldap to a string (ldap.to_s) if it complains about not being able to add " " to a not-String. >Thanks for the reply Felix, actually it wasn''t necessary any particular interpolation , I just discovered that actually I wasn''t passing an array to the template... Regards, Al -- 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.
Is there any reason why you don''t just do it the easy way? host <%= users_ldap_servers.join(" ") %> On Fri, Sep 10, 2010 at 5:50 AM, Al @ Lab42 <lab42.it@gmail.com> wrote:> Hi all, > I''ve a silly problem that it''s driving me crazy and I''m almost sure > the solution is quick and easy. > Still it doesn''t seem at my reach. > > I''ve a variable with an array of values, such as: > users_ldap_servers = [ "ldapm.example42.com" , "ldaps.example42.com" ] > > I want to use these values in a single line of a template: > > host <% users_ldap_servers.each do |ldap| %> <%= ldap %> <% end %> > > No matter how many spaces I place around, no matter the absence of > trimming -%> I always get something like: > > host ldapm.example42.comldaps.example42.com > instead of: > host ldapm.example42.com ldaps.example42.com > > I think a solution could be to add a whitespace to "ldap" before > yielding it... but I haven''t found the needed "few chars combo" (I > suppose). > > Any help? > Al > > -- > 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<puppet-users%2Bunsubscribe@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.
On Sep 10, 5:20 pm, Brian Gallew <g...@gallew.org> wrote:> Is there any reason why you don''t just do it the easy way? > > host <%= users_ldap_servers.join(" ") %>Nice. Still the problem was elsewhere and what I thought to be an array became a string. Thanks anyway Al -- 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.