# Attribute Precedence in recipe level

**URL:** <https://discourse.chef.io/t/attribute-precedence-in-recipe-level/3978>\
**Category:** Chef Infra (archive)\
**Created:** [May 20, 2013, 11:40am UTC](https://discourse.chef.io/t/attribute-precedence-in-recipe-level/3978 "2013-05-20T11:40:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![millisami\_r](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/millisami_r/32/418_2.png) [@millisami\_r](https://discourse.chef.io/u/millisami_r)\
**Post date:** [May 20, 2013, 11:40am UTC](https://discourse.chef.io/t/attribute-precedence-in-recipe-level/3978/1 "2013-05-20T11:40:13Z")

</div>

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

> **[Chef 11 In-Depth: Attributes Changes - Chef Blog](https://blog.chef.io/chef-11-in-depth-attributes-changes/)**
>
> Chef 11 In-Depth: Attributes Rewrite Chef’s attributes system is frequently cited by power users as one of their favorite features. Chef users love having the flexibility to tune their applications based on a node’s role or environment. Since we...

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://tfm.com.np)  
[http://nepalonrails.com](http://nepalonrails.com)

---

<div class="post-metadata">

**Author:** ![AJ\_Christensen](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/aj_christensen/32/525_2.png) [@AJ\_Christensen](https://discourse.chef.io/u/AJ_Christensen)\
**Post date:** [May 20, 2013, 10:16pm UTC](https://discourse.chef.io/t/attribute-precedence-in-recipe-level/3978/2 "2013-05-20T22:16:07Z")

</div>

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](mailto: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  
> [Chef 11 In-Depth: Attributes Changes - Chef Blog | Chef](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://tfm.com.np)  
> [http://nepalonrails.com](http://nepalonrails.com)
