I am having an issue with templates that I cant quite figure out why it is having an issue. I am using ruby dsl to read a template from a database and it keeps having problems with anything other than <%= var %> type definitions. I even went as far cutting and pasting from the puppet online documentation just to see if it were maybe something I goofed. I pasted below the tested template and the error that I get with it. <% scope.to_hash.keys.each do |k| -%> <%= k %> <% end -%> err: compile error (erb):2: syntax error, unexpected $end, expecting kEND _erbout ^ -- 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.
What is interesting to note is if I change the template to <% scope.to_hash.keys.each do |k| %> <%= k %> <%= "\n" %><% end %> The error goes away. I probably should have said this is related to Ruby DSL inline template function, I havent been able to reproduce this with erb files stored locally. On Nov 4, 10:47 am, Matt <mjbl...@gmail.com> wrote:> I am having an issue with templates that I cant quite figure out why > it is having an issue. > > I am using ruby dsl to read a template from a database and it keeps > having problems with anything other than <%= var %> type definitions. > > I even went as far cutting and pasting from the puppet online > documentation just to see if it were maybe something I goofed. I > pasted below the tested template and the error that I get with it. > > <% scope.to_hash.keys.each do |k| -%> > <%= k %> > <% end -%> > > err: compile error > (erb):2: syntax error, unexpected $end, expecting kEND > _erbout > ^-- 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.
I figured out the problem, which is a different behavior from Puppet DSL. Puppet DSL converts the entries entered into inline_template into an array based on comma but the Ruby DSL does not do this. if I make the inline_template argument like below :content => inline_template([mytemplate]) it works correctly. On Nov 4, 11:10 am, Matt <mjbl...@gmail.com> wrote:> What is interesting to note is if I change the template to > <% scope.to_hash.keys.each do |k| %> <%= k %> <%= "\n" %><% end %> > > The error goes away. > > I probably should have said this is related to Ruby DSL inline > template function, I havent been able to reproduce this with erb files > stored locally. > > On Nov 4, 10:47 am, Matt <mjbl...@gmail.com> wrote: > > > > > > > > > I am having an issue with templates that I cant quite figure out why > > it is having an issue. > > > I am using ruby dsl to read a template from a database and it keeps > > having problems with anything other than <%= var %> type definitions. > > > I even went as far cutting and pasting from the puppet online > > documentation just to see if it were maybe something I goofed. I > > pasted below the tested template and the error that I get with it. > > > <% scope.to_hash.keys.each do |k| -%> > > <%= k %> > > <% end -%> > > > err: compile error > > (erb):2: syntax error, unexpected $end, expecting kEND > > _erbout > > ^-- 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.
Seemingly Similar Threads
- hash to_yaml in erb template not giving valid yaml
- Puppet and Mcollective yaml file changing when it shouldn't
- Are tildes actually valid in templates or is this a bug?
- Unnecessary changes when creating facts.yaml
- How to include the Scope(...) in a generated string?