On May 29, 1:11 pm, Brian Carpio <bcar...@thetek.net> 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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to