- From: Alex Soto <
>
- To:
- Subject: [chef] Re: Re: Re: Re: undefined method `[]' for nil:NilClass
- Date: Thu, 18 Feb 2010 01:13:18 -0800
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=references:in-reply-to:mime-version:content-type:message-id :content-transfer-encoding:from:subject:date:to:x-mailer; b=YivMQAmMfLdSQ6rOt1TSjwfkRNOhKvXZpIngbEPwRr4ttrLhY2vChjkREEwBr9902S 9R1aGRVa3O/nf3mLPWkOr7JBlIPT8O4lB5rjyipprBnMr+ra5hnBF92NePfVTsQrJz+W ODlcqivOPMsj3H8DbEsERF6w/+M4+wCDMRdXs=
Should work assuming localhost is not already nil to begin with. I don't
know what localhost is so tough for me to give more help. Is it a string,
array, hash, etc?
Alex
On Feb 18, 2010, at 1:04 AM, Oliver Rojo wrote:
>
By the way, on the default recipe script, I defined the variable this way:
>
>
variables(:localhost => localhost, :hosts => hosts)
>
>
and calling it on the templates:
>
localip <%= @localhost["ipaddress"] %>
>
>
>
>
>
----- Original Message -----
>
From: Oliver Rojo
>
[mailto:
>
To:
>
>
Sent: Thu, 18 Feb
>
2010 08:56:17 +0000
>
Subject: [chef] Re: Re: undefined method `[]' for
>
nil:NilClass
>
>
>
>
>
> ----- Original Message -----
>
> From: Alex Soto
>
> [mailto:
>
> To:
>
>
>
> Sent: Thu, 18 Feb 2010
>
> 08:45:31 +0000
>
> Subject: [chef] Re: undefined method `[]' for nil:NilClass
>
>
>
>
>
>> @node is how to get node attributes unless you defined a variable named
>
>> localhost.
>
>
>
> Tried changing @localhost to @node but the same error still exists.
>
>>
>
>> 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
>
>>
>
>>
>
>
Archive powered by MHonArc 2.6.16.