Mohamed Lrhazi
2011-Feb-10 22:15 UTC
[Puppet Users] Unwanted whitespace generated by template
I have this in a template: ===============cut here====================# Allow ICMP traffic -A RH-Firewall-1-INPUT -p icmp --icmp-type any -j ACCEPT <% if netbackup_master_servers %> <% netbackup_master_servers.each do |master_server| -%> # Allow communication with NetBackup master server <%= master_server[0] %> -A RH-Firewall-1-INPUT -p tcp -m tcp -s <%= master_server[1] %> --dport 13724 -j ACCEPT ===============cut here==================== One extra line containing a single white space is added, after the one already there. iptables fails to load because of this... Is it the "if" tag that generated the line? how do I avoid that? Thanks a lot. Mohamed. -- 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.
Adam Gibbins
2011-Feb-10 22:19 UTC
Re: [Puppet Users] Unwanted whitespace generated by template
On 10 February 2011 22:15, Mohamed Lrhazi <lrhazi@gmail.com> wrote:> I have this in a template: > > ===============cut here====================> # Allow ICMP traffic > -A RH-Firewall-1-INPUT -p icmp --icmp-type any -j ACCEPT > > <% if netbackup_master_servers %> > <% netbackup_master_servers.each do |master_server| -%> > # Allow communication with NetBackup master server <%= master_server[0] %> > -A RH-Firewall-1-INPUT -p tcp -m tcp -s <%= master_server[1] %> > --dport 13724 -j ACCEPT > ===============cut here====================> > > One extra line containing a single white space is added, after the one > already there. > iptables fails to load because of this... > > Is it the "if" tag that generated the line? how do I avoid that? > > Thanks a lot. > Mohamed. >Terminating with -%> rather than %> will stop the trailing whitespace. -- 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.
Nan Liu
2011-Feb-10 22:19 UTC
Re: [Puppet Users] Unwanted whitespace generated by template
On Thu, Feb 10, 2011 at 2:15 PM, Mohamed Lrhazi <lrhazi@gmail.com> wrote:> I have this in a template: > > ===============cut here====================> # Allow ICMP traffic > -A RH-Firewall-1-INPUT -p icmp --icmp-type any -j ACCEPT > > <% if netbackup_master_servers %>Suppress the new line with a -%> <% if netbackup_master_servers -%> Thanks, Nan -- 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.
Mohamed Lrhazi
2011-Feb-10 22:24 UTC
Re: [Puppet Users] Unwanted whitespace generated by template
Thanks a lot. Turns out I also had an actual whitespace after the "if tag" !! On Thu, Feb 10, 2011 at 5:19 PM, Nan Liu <nan@puppetlabs.com> wrote:> On Thu, Feb 10, 2011 at 2:15 PM, Mohamed Lrhazi <lrhazi@gmail.com> wrote: >> I have this in a template: >> >> ===============cut here====================>> # Allow ICMP traffic >> -A RH-Firewall-1-INPUT -p icmp --icmp-type any -j ACCEPT >> >> <% if netbackup_master_servers %> > > Suppress the new line with a -%> > > <% if netbackup_master_servers -%> > > Thanks, > > Nan > > -- > 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. > >-- 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.