[chef] Re: Re: Re: Re: Re: Re: Attributes not getting set from wrapper cookbook


Chronological Thread 
  • From: millisami r < >
  • To: chef < >
  • Subject: [chef] Re: Re: Re: Re: Re: Re: Attributes not getting set from wrapper cookbook
  • Date: Sat, 14 Dec 2013 10:53:00 +0545

Alright, so the take-away from here is that lets not have the nested computed attributes.
Just go along plain and simple attributes.
Thnaks



@millisami
~Sachin Sagar Rai
Ruby on Rails Developer
http://tfm.com.np
http://nepalonrails.com


On Thu, Dec 12, 2013 at 9:56 PM, Julian C. Dunn < " target="_blank"> > wrote:
On Wed, Dec 11, 2013 at 10:05 PM, millisami r < "> > wrote:
> I've already gone through your blog post as well.
>
> Looks like everyone should define their attributes in a single level.
> But what for the cases like below where redefining the attributes that take
> multilevel hash.
>
>     default['rvm']['user_installs'] = [
>       { 'user'          => node['asm']['user'],
>         'rubies'        => [node["asm"]["rvm"]["ruby"]],
>         'default_ruby'    => node["asm"]["rvm"]["ruby"],
>         'global_gems' => [
>             { 'name'    => 'bundler' },
>             { 'name'    => 'rake',
>               'version' => '10.1.0'
>             },
>             {
>               'name' => 'unicorn'
>             }
>         ]
>       }
>     ]
>
> Do I've to redefine the whole attributes for
> `default['rvm']['user_installs']` just to override the
> `node['asm']['user']` in the wrapper cookbook.
>
> Or is the idea of nesting attributes is wrong?

It's more that things get difficult when you start mixing and matching
types for your attributes. Many people choose to structure their
attributes as hashes only for a number of reasons, merge order and
overriding being one of them.

Another good reason which has nothing to do with Chef is just ease of
reference. For example, how do you easily refer to or find the RVM
user_install for the ASM user above? You'd be forced to grab the
entire array and poke through it.

- Julian

--
[ Julian C. Dunn < "> >          * Sorry, I'm    ]
[ WWW: http://www.aquezada.com/staff/julian    * only Web 1.0  ]
[ gopher://sdf.org/1/users/keymaker/           * compliant!    ]
[ PGP: 91B3 7A9D 683C 7C16 715F 442C 6065 D533 FDC2 05B9       ]




Archive powered by MHonArc 2.6.16.

§