So, I have
check_command check_nrpe!check_ntp_drift!<%= env['ntpservers'][0] %>
in a template .erb file.
This gives the error Function Call, Failed to parse template icinga/etc/icinga/COLLECT/icinga/base.cfg.erb: Filepath: /etc/puppetlabs/code/environments/prod/modules/icinga/templates/etc/icinga/COLLECT/icinga/base.cfg.erb Line: 50 Detail: undefined local variable or method `env' for #
during a puppet agent run.
'env' is defined in site.pp $env = hiera_hash(env) Can anyone provide the correct syntax please (this is on puppet 4, ported from working puppet 3 if that helps)
This gives the error Function Call, Failed to parse template icinga/etc/icinga/COLLECT/icinga/base.cfg.erb: Filepath: /etc/puppetlabs/code/environments/prod/modules/icinga/templates/etc/icinga/COLLECT/icinga/base.cfg.erb Line: 50 Detail: undefined local variable or method `env' for #
'env' is defined in site.pp $env = hiera_hash(env) Can anyone provide the correct syntax please (this is on puppet 4, ported from working puppet 3 if that helps)
Thanks
Chris
@Lupin: y, funnily enough I just tried that (randomly) and it worked.
My prob is I'm new to puppet and know zero about Ruby. I'm not clear on the different syntax's of each lang and eg whether/when to differentiate between hash, array, element of hash/array and what syntax to use in each case.
I guess this is 'Solved' :)
PS: If you're good with hiera, can you take a look at https://ask.puppet.com/question/26713/hiera-lookup-failure/ ?