FAQ
Hi,

I have a template which looks like this

<% scope.lookupvar('openldap::params::ldapservers').each do |var| -%>
olcSyncrepl: {0}rid=001 provider="ldap://<%= var %>:389"
type=refreshAndPer
sist retry="5 5 300 +" searchbase="<%=
scope.lookupvar('openldap::params::searchbase') %>" attrs="*,+"
bindmeth
od=simple binddn="cn=<%= scope.lookupvar('openldap::params::binddn')
%>" credentials="<%= scope.lookupvar('openldap::params::secret') %>"
<% end -%>


I want to auto increment the {0}rid=001 for each iteration of the
loop. Is there an easy way to do this with out creating a hash map?



Thanks,
Brian Carpio

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

Search Discussions

  • Jcbollinger at May 30, 2012 at 12:51 pm

    On May 29, 1:11 pm, Brian Carpio wrote:
    Hi,

    I have a template which looks like this

    <% scope.lookupvar('openldap::params::ldapservers').each do |var| -%>
    olcSyncrepl: {0}rid=001 provider="ldap://<%= var %>:389"
    type=refreshAndPer
    sist retry="5 5 300 +" searchbase="<%=
    scope.lookupvar('openldap::params::searchbase') %>" attrs="*,+"
    bindmeth
    od=simple binddn="cn=<%= scope.lookupvar('openldap::params::binddn')
    %>" credentials="<%= scope.lookupvar('openldap::params::secret') %>"
    <% end -%>

    I want to auto increment the {0}rid=001 for each iteration of the
    loop. Is there an easy way to do this with out creating a hash map?

    Should be. Try this:

    <% rid = 0
    scope.lookupvar('openldap::params::ldapservers').each do |var| -%>
    olcSyncrepl: {0}rid=<%=printf("%03d", rid += 1)%> provider="ldap://<%=
    var %>:389"
    [...]

    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.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppuppet-users @
categoriespuppet
postedMay 29, '12 at 6:11p
activeMay 30, '12 at 12:51p
posts2
users2
websitepuppetlabs.com

2 users in discussion

Brian Carpio: 1 post Jcbollinger: 1 post

People

Translate

site design / logo © 2022 Grokbase