On Wed, Dec 11, 2013 at 10:05 PM, millisami r < "> > wrote:It's more that things get difficult when you start mixing and matching
> 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?
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.