John Warburton
2012-Mar-08 22:28 UTC
[Puppet Users] How do I quote a percent sign in the text of a template?
Hi I am scratching my head on this not being a ruby person... I am turning my kickstart files into templates, but am having issues with percent signs in free form text. This returns a syntax error: %post OK, fine , let me escape it: %%post No error, but the end result is %%post Not quite what I wanted I''m missing something blindingly obvious - can someone point me to it? :-) Thanks 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.
Garrett Honeycutt
2012-Mar-08 22:58 UTC
Re: [Puppet Users] How do I quote a percent sign in the text of a template?
On 3/8/12 4:28 PM, John Warburton wrote:> Hi > > I am scratching my head on this not being a ruby person... > > I am turning my kickstart files into templates, but am having issues > with percent signs in free form text. This returns a syntax error: > %post > > OK, fine , let me escape it: > > %%post > > No error, but the end result is > %%post > > Not quite what I wanted > > I''m missing something blindingly obvious - can someone point me to it? :-) > > Thanks > > JohnJohn, What is the error that you are receiving? ERB should not have any problems with percent signs in a template. I use the following bash function to help me with syntax checking. # puppet template syntax checking function pt() { if [ -z $1 ]; then echo "usage: pt <puppet_template_file.erb>" return; fi /usr/bin/erb -P -x -T ''-'' $1 | /usr/bin/ruby -c } -g -- Garrett Honeycutt 206.414.8658 http://puppetlabs.com -- 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.
John Warburton
2012-Mar-09 02:21 UTC
Re: [Puppet Users] How do I quote a percent sign in the text of a template?
On 9 March 2012 09:58, Garrett Honeycutt <garrett@puppetlabs.com> wrote:> On 3/8/12 4:28 PM, John Warburton wrote: > > I am turning my kickstart files into templates, but am having issues > > with percent signs in free form text. This returns a syntax error: > > %post >ERB should not have any problems with percent signs in a template. I use> the following bash function to help me with syntax checking. > > # puppet template syntax checking > function pt() > { > if [ -z $1 ]; then > echo "usage: pt <puppet_template_file.erb>" > return; > fi > /usr/bin/erb -P -x -T ''-'' $1 | /usr/bin/ruby -c > } > >Thanks to an off list discussion, my problem was really with a line that looked like "%post --logfile /root/ks-postinstall.log" and the "-P" in the pre-commit hook told erb to ignore lines starting with a "%" for checking I have updated the erb checks in https://projects.puppetlabs.com/projects/puppet/wiki/Puppet_Version_Controlto include "-P" Thanks Garrett 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.