- From: Noah Kantrowitz <
>
- To:
- Subject: [chef] Re: Re: HWRP Array attribute not reset
- Date: Tue, 11 Mar 2014 15:39:40 -0700
You are probably running in to the merge behavior of arrays in node
attributes. Check out
https://coderanger.net/2013/06/arrays-and-chef/ for
more info.
--Noah
On Mar 11, 2014, at 3:35 PM, "Stewart, Curtis"
<
>
wrote:
>
Attribute Sample:
>
>
node[‘servers’][‘main’][‘external_addresses’] = %w { 33.33.33.33 }
>
>
Recipe Context:
>
>
node[’servers'].each do |name, options|
>
server name do
>
external_addresses options['external_addresses']
>
end
>
end
>
>
Then, if I update that attribute value to, say %w{ 33.33.33.30 }, the
>
resource loads with both addresses.
>
>
Curtis
>
>
On Mar 11, 2014, at 5:20 PM, Noah Kantrowitz
>
<
>
>
wrote:
>
>
> Can you give an example of how you are using it?
>
>
>
> --Noah
>
>
>
> On Mar 11, 2014, at 3:19 PM, "Stewart, Curtis"
>
> <
>
>
> wrote:
>
>
>
>> I’m working with a custom HWRP, and I have an attribute of type Array.
>
>>
>
>> The definition is below, and the issue I’m trying to trouble shoot is
>
>> that if I update the value of my array, instead of resetting the array,
>
>> they new values are appended to the array.
>
>>
>
>>
>
>> def external_addresses(arg = nil)
>
>> set_or_return(:external_addresses, arg, :kind_of => Array)
>
>> end
>
>>
>
>>
>
>> Thanks for any feedback,
>
>> Curtis
>
>
>
Attachment:
signature.asc
Description: Message signed with OpenPGP using GPGMail
Archive powered by MHonArc 2.6.16.