Hi Russel, I tried to use reference the variable as below, but got an error. <%= @hostname["interfaces_ipv4"]["eth0"]["bootproto"] %>
Error Oct 12 13:04:06 box32 puppet-agent[37813]: Could not retrieve catalog from remote server: Error 400 on SERVER: Evaluation Error: Error while evaluating a Function Call, Failed to parse template network/ifcfg-ethX.erb: Oct 12 13:04:06 box32 puppet-agent[37813]: Filepath: /etc/puppetlabs/code/ environments/production/modules/network/templates/ifcfg-ethX.erb Oct 12 13:04:06 box32 puppet-agent[37813]: Line: 4 Oct 12 13:04:06 box32 puppet-agent[37813]: Detail: undefined method `[]' for nil:NilClass Regards, Vikas On Monday, 12 October 2015 12:23:24 UTC+11, Russell Miller wrote: > > Don't forget the "@". Ruby scoping rules still apply. > > <%= @hostname["interfaces_ipv4"]["eth0"]["bootproto"] %> should work, > though I haven't tested it, obviously. > > Also don't forget that puppet scoping rules ALSO apply, so the variable > has to be accessible from the class from which the templating is done. You > could do (I think) lookup_scopevar or some such to get around that. > > --Russell > > On Sunday, October 11, 2015 at 5:54:35 PM UTC-7, Vikas Kumar wrote: >> >> Hi Red, >> >> I did tried that, but it is not working for me. >> >> <%= hostname[interfaces_ipv4][eth0][bootproto] %> >> >> or even >> <%= os[release][major] %> >> Regards, >> Vikas >> >> >> On Monday, 12 October 2015 11:19:15 UTC+11, red wrote: >>> >>> I asked almost the same question on ask puppet >>> >>> >>> https://ask.puppetlabs.com/question/1295/getting-hiera-data-into-my-erb-template/ >>> >>> -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/eb2893f6-afb4-4652-a449-4239ad4a29b8%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.