[chef] Re: HWRP Array attribute not reset


Chronological Thread 
  • From: "Stewart, Curtis" < >
  • To: " " < >
  • Subject: [chef] Re: HWRP Array attribute not reset
  • Date: Tue, 11 Mar 2014 22:35:48 +0000
  • Accept-language: en-US

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





Archive powered by MHonArc 2.6.16.

§