Hiya,

I've recently updated my svn server so that it checks the syntax of
.erb files, on commit, along with .pp files.  While doing this, I ran
across a small but niggling issue and wanted to see if I was just
doing something wrong or if it was a bug.

In my sudoers template file, I have a number of lines that start along
the lines of:

%sup    ALL=NOPASSWD: ALL
%mon    ALL=NOPASSWD: ALL

I've never had any problems with this template, but upon checking the file with:

erb -x -T '-' sudoers.erb | ruby -c

Which gives the error:

-:28: syntax error, unexpected ':', expecting $end
; sup       ALL=NOPASSWD: ALL

So.. after a bit of investigation, I found the following line in the
ruby docs 
(http://www.ensta.fr/~diam/ruby/online/ruby-doc-stdlib/libdoc/erb/rdoc/index.html)

"% a line of Ruby code -- treated as <% line %> (optional -- see ERB.new)
  %% replaced with % if first thing on a line and % processing is used"

Awesome! That explains that then!

So I updated my template to read:

%%sup    ALL=NOPASSWD: ALL
%%mon    ALL=NOPASSWD: ALL

Ran it past erb.. no error.. sorted!.... Except.. When I actually use
that template within puppet.. the %% is not evaluated and the double
%% ends up being placed in the generated file too..

I realise that one solution here is to just not check the syntax of
the template with erb (as it works absolutely fine with a single %)..
However, it feels a little bit broken or (quite possibly) I'm missing
something obvious so would be good to get some feedback.

Thanks in advance!

-- 
Tim
[email protected]

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to