Re: [Puppet Users] Re: Blank lines in conditional templates

2011-04-07 Thread Arthur Clune
Thank you! There were indeed spaces at the end of lines.

Arthur

-- 
Arthur Clune

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



Re: [Puppet Users] Blank lines in conditional templates

2011-04-07 Thread Arthur Clune
It's been suggested that I just create the output string in code,
which works fine. I've put a working version in the gist.

> https://gist.github.com/907330

-- 
Arthur Clune art...@clune.org

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



Re: [Puppet Users] Blank lines in conditional templates

2011-04-07 Thread Arthur Clune
On Thu, Apr 7, 2011 at 5:26 AM, Ben Hughes  wrote:

> I tried to recreate this, but your mailer has munged all the lines to fit
> in 80 columns, so I can't tell where all the breaks should be, so can't
> test it. Could you pastie or similar it?

Thanks for looking at this. I've put it up at gist

https://gist.github.com/907330

I've tried various variations on the line layout but all seem to give
the same result: if the name isn't defined, I get a blank line rather
than no line at all.

Arthur


-- 
Arthur Clune art...@clune.org

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



[Puppet Users] Blank lines in conditional templates

2011-04-06 Thread Arthur Clune

I'm writing ldirectord.cf files via puppet and unfortunately
ldirectord is sensitive to blank lines in the file. I have the
following code in my .erb file

virtual=<%= vip %>:<%= port %>
<% if weights.empty? then -%><% real_servers.each do |real_server| -%>
real=<%= real_server %>:<%= port %> gate
<% end -%><% else -%><% real_servers.zip(weights).each do |
real_server, weight| -%>
real=<%= real_server %>:<%= port %> gate <%= weight %>
<% end -%><% end -%>
<% if not checktype.empty? then -%>checktype=<%= checktype -%><%
end -%>
<% if not service.empty? then -%>service=<%= service %><% end -
%>
<% if not checkcommand.empty? then -%>checkcommand=<%=
checkcommand %><% end -%>
protocol=<%= protocol %>
scheduler=<%= scheduler %>
persistent=<%= persistent %>

This all works fine. If (say) checktype == 'fred' then I get a line

checktype=fred

My problem is that is checktype == '', the checktype = line isnt'
printed (correct) but I get a blank line instead.

e.g.

virtual=192.168.1.1:53
real=192.168.1.2:53 gate
real=192.168.1.3:53 gate


protocol=udp
scheduler=rr
persistent=300


How can I stop those blank lines from appearing?

Thanks

Arthur

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