Is there any Ruby DSL expert that has a clue how to use the template function properly?
Thanks On Aug 12, 9:06 pm, piavlo <[email protected]> wrote: > HI, > > I'm trying to use tamplate function in ruby dsl but I miserably fail. > Then I just invoke it without using it in any resource like this > > template ['nagios/conf.d/app_alerts/ssa_nagios_contact.erb'], > > it works and i see > > .... > debug: Scope(Class[Nagios::Ssa_nagios_contacts]): Retrieving template > nagios/conf.d/app_alerts/ssa_nagios_contact.erb > debug: template[/etc/puppet/modules/nagios/templates/conf.d/app_alerts/ > ssa_nagios_contact.erb]: Bound template variables for /etc/puppet/ > modules/nagios/templates/conf.d/app_alerts/ssa_nagios_contact.erb in > 0.00 > seconds > debug: template[/etc/puppet/modules/nagios/templates/conf.d/app_alerts/ > ssa_nagios_contact.erb]: Interpolated template /etc/puppet/modules/ > nagios/templates/conf.d/app_alerts/ssa_nagios_contact.erb in 0.00 > seconds > ... > > But obviously i need to use it inside resource - which does not work > > file( "#{nagios_confdir}/app_alerts/ssa/contacts/#{x['doc'] > ['_id']}.cfg", > :content => template ['nagios/conf.d/app_alerts/ > ssa_nagios_contact.erb'], > :ensure => :file, > :owner => 'root', > :group => 'root', > :mode => 0755, > :require => "File[#{nagios_confdir}/app_alerts/ssa/contacts]" ) > > end > > this fails with: > > debug: importing '/etc/puppet/modules/nagios/manifests/ > ssa_nagios_contacts.rb' in environment production > err: (eval):53:in `parse_ruby_file': compile error > (eval):42: syntax error, unexpected tLBRACK, expecting kDO or '{' or > '(' > :content => template ['nagios/conf.d/app_alerts/ > ssa_... > > ^ > (eval):42: syntax error, unexpected ',', expecting > kEND > (eval):44: syntax error, unexpected ',', expecting > kEND > (eval):45: syntax error, unexpected ',', expecting > kEND > (eval):47: syntax error, unexpected ')', expecting > kEND > (eval):53: syntax error, unexpected $end, expecting kEND > > Please help. > > Thanks > Alex -- 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.
