template should be a string, not an array

content => template("'nagios/ssa_nagios_contact.erb") # assuming it's in 
modules/nagios/templates

also, I think your 'require' should probably look like

require => File["#{nagios_confdir}/app_alerts/ssa/contacts"],

but maybe your way will work

Craig

On Aug 12, 2011, at 11:06 AM, piavlo 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.
> 

-- 
Craig White ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  [email protected]
1.800.869.6908 ~~~~~~~~~~~~~~~~~~~~~~~~~~~ www.ttiassessments.com 

Need help communicating between generations at work to achieve your desired 
success? Let us help!

-- 
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