Undefined method `[]' for nil:NilClass


#1

How can i fix this error?

Chef::Mixin::Template::TemplateError (undefined method `[]’ for nil:NilClass)

I’m using:

<%= @localhost[“ipaddress”] %> on one of my template and suddenly after running chef-client, it stops with the above error.

Please help!

Oliver


#2

@node is how to get node attributes unless you defined a variable named localhost.

On Feb 18, 2010, at 12:37 AM, Oliver Rojo wrote:

How can i fix this error?

Chef::Mixin::Template::TemplateError (undefined method `[]’ for nil:NilClass)

I’m using:

<%= @localhost[“ipaddress”] %> on one of my template and suddenly after running chef-client, it stops with the above error.

Please help!

Oliver