Attribute Precedence in recipe level


#1

In my cookbook default attribute file:

default['theoryofvalues-wp']['directory'] = "/var/www/theoryofvalues-wp"

And I’m trying to use the Wordpress cookbook (for e.g.) and I want to
override the attribute
node.default[‘wordpress’][‘dir’]

So in my recipe I set that attribute to:

node.default['wordpress']['dir'] =

node[‘theoryofvalues-wp’][‘directory’]

But it does not affect.
I even tried with other versions

include_recipe "wordpress::default"
node.set['wordpress']['dir'] = node['theoryofvalues-wp']['directory']
node.override['wordpress']['dir'] =

node[‘theoryofvalues-wp’][‘directory’]

Yeah, since I’m using chef 11 and the attributes precedence has changed,
but am I doing it wrong?

Went through the following post and still not much clear on this

Any good example to follow with a one that is bad practices.

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


#2

What precedence level is node[‘wordpress’][‘dir’] being set at?

Post chef11, we’d use ‘node.set’ for something like this, or ‘set’ in
the attributes.

In the recipe, you can use ‘node.debug_value(:wordpress, :dir)’ to see
more diagnostic information.

Cheers,

AJ

On 20 May 2013 23:40, millisami r millisami@gmail.com wrote:

In my cookbook default attribute file:

default['theoryofvalues-wp']['directory'] = "/var/www/theoryofvalues-wp"

And I’m trying to use the Wordpress cookbook (for e.g.) and I want to
override the attribute
node.default[‘wordpress’][‘dir’]

So in my recipe I set that attribute to:

node.default['wordpress']['dir'] =

node[‘theoryofvalues-wp’][‘directory’]

But it does not affect.
I even tried with other versions

include_recipe "wordpress::default"
node.set['wordpress']['dir'] = node['theoryofvalues-wp']['directory']
node.override['wordpress']['dir'] =

node[‘theoryofvalues-wp’][‘directory’]

Yeah, since I’m using chef 11 and the attributes precedence has changed, but
am I doing it wrong?

Went through the following post and still not much clear on this
http://www.opscode.com/blog/2013/02/05/chef-11-in-depth-attributes-changes/

Any good example to follow with a one that is bad practices.

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