[chef-dev] Re: Re: Setting node attributes with a knife plugin


Chronological Thread 
  • From: < >
  • To:
  • Subject: [chef-dev] Re: Re: Setting node attributes with a knife plugin
  • Date: Wed, 25 Jan 2012 01:56:17 -0800 (PST)

Hey, 

thank you very much, this helped a lot.

The line
*parts, last = @attributes.split('.') 
doesn't work with ruby1.8, so I did it this way (to remain backwards
compatible):

        allparts = @attribute.split('.')
        parts = allparts[0..-2]
        last = allparts[-1]
        hash = parts.inject(@node){|h, attr| h[attr]}
        puts hash[last]
        hash[last] = @new_value
        @node.save

Cheers,

Oscar



Archive powered by MHonArc 2.6.16.

§