# Environment override attrs doesn't take precedence over node attributes

**URL:** <https://discourse.chef.io/t/environment-override-attrs-doesnt-take-precedence-over-node-attributes/2571>\
**Category:** Chef Infra (archive)\
**Created:** [March 19, 2012, 4:02pm UTC](https://discourse.chef.io/t/environment-override-attrs-doesnt-take-precedence-over-node-attributes/2571 "2012-03-19T16:02:27Z")\
**Posts on this page:** 3\
**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:** [March 19, 2012, 4:02pm UTC](https://discourse.chef.io/t/environment-override-attrs-doesnt-take-precedence-over-node-attributes/2571/1 "2012-03-19T16:02:27Z")

</div>

THe following is my environments/production.rb file

```
name "production"
description "The production environment"
override_attributes "apache2" => { "listen_ports" => ["80", "443"] }

```

And in the recipe cookbooks/application/recipes/mod\_php\_apache2.rb, there is

```
node.default['apache']['listen_ports'] = ["8080"] at line 22

```

In the wiki [http://wiki.opscode.com/display/chef/Attributes](http://wiki.opscode.com/display/chef/Attributes), it says that the `environment override_attributes` will take the precedence over the node attributes. But in my every chef run, the port gets set to 8080 in the file `/etc/apache2/ports.conf`

Why is this?

* * *

@millisami  
~ Sachin Sagar Rai  
Ruby on Rails Developer  
[http://tfm.com.np](http://tfm.com.np)  
[http://nepalonrails.tumblr.com](http://nepalonrails.tumblr.com)  
Sent with Sparrow ([http://www.sparrowmailapp.com/?sig](http://www.sparrowmailapp.com/?sig))

---

<div class="post-metadata">

**Author:** ![werebus](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/werebus/32/24_2.png) [@werebus](https://discourse.chef.io/u/werebus)\
**Post date:** [March 19, 2012, 4:46pm UTC](https://discourse.chef.io/t/environment-override-attrs-doesnt-take-precedence-over-node-attributes/2571/2 "2012-03-19T16:46:38Z")

</div>

I don't know if this is just a typo, but you show your override attribute  
as [apache2][listen\_ports] and the default attribute is  
[apache][listen\_ports] without the "2".

-Matt Moretti

On Mon, Mar 19, 2012 at 12:02 PM, Sachin Sagar Rai [millisami@gmail.com](mailto:millisami@gmail.com)wrote:

> THe following is my environments/production.rb file
> 
> ```
> name "production"
> description "The production environment"
> override_attributes "apache2" => { "listen_ports" => ["80", "443"] }
> 
> ```
> 
> And in the recipe cookbooks/application/recipes/mod\_php\_apache2.rb, there  
> is
> 
> ```
> node.default['apache']['listen_ports'] = ["8080"] at line 22
> 
> ```
> 
> In the wiki [http://wiki.opscode.com/display/chef/Attributes](http://wiki.opscode.com/display/chef/Attributes), it says that  
> the `environment override_attributes` will take the precedence over the  
> node attributes. But in my every chef run, the port gets set to 8080 in the  
> file `/etc/apache2/ports.conf`
> 
> Why is this?
> 
> * * *
> 
> @millisami  
> ~ Sachin Sagar Rai  
> Ruby on Rails Developer  
> [http://tfm.com.np](http://tfm.com.np)  
> [http://nepalonrails.tumblr.com](http://nepalonrails.tumblr.com)  
> Sent with Sparrow [http://www.sparrowmailapp.com/?sig](http://www.sparrowmailapp.com/?sig)

---

<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:** [March 19, 2012, 5:26pm UTC](https://discourse.chef.io/t/environment-override-attrs-doesnt-take-precedence-over-node-attributes/2571/3 "2012-03-19T17:26:07Z")

</div>

@Matt, thanks.  
So stupid of me that I didn't see that.

* * *

@millisami  
~ Sachin Sagar Rai  
Ruby on Rails Developer  
[http://tfm.com.np](http://tfm.com.np)  
[http://nepalonrails.tumblr.com](http://nepalonrails.tumblr.com)  
Sent with Sparrow ([http://www.sparrowmailapp.com/?sig](http://www.sparrowmailapp.com/?sig))

On Monday, March 19, 2012 at 10:31 PM, Matthew Moretti wrote:

> I don't know if this is just a typo, but you show your override attribute as [apache2][listen\_ports] and the default attribute is [apache][listen\_ports] without the "2".
> 
> -Matt Moretti
> 
> On Mon, Mar 19, 2012 at 12:02 PM, Sachin Sagar Rai \<[millisami@gmail.com](mailto:millisami@gmail.com) ([mailto:millisami@gmail.com](mailto:millisami@gmail.com))\> wrote:
> 
> > THe following is my environments/production.rb file
> > 
> > ```
> > name "production"
> > description "The production environment"
> > override_attributes "apache2" => { "listen_ports" => ["80", "443"] }
> > 
> > ```
> > 
> > And in the recipe cookbooks/application/recipes/mod\_php\_apache2.rb, there is
> > 
> > ```
> > node.default['apache']['listen_ports'] = ["8080"] at line 22
> > 
> > ```
> > 
> > In the wiki [http://wiki.opscode.com/display/chef/Attributes](http://wiki.opscode.com/display/chef/Attributes), it says that the `environment override_attributes` will take the precedence over the node attributes. But in my every chef run, the port gets set to 8080 in the file `/etc/apache2/ports.conf`
> > 
> > Why is this?
> > 
> > * * *
> > 
> > @millisami  
> > ~ Sachin Sagar Rai  
> > Ruby on Rails Developer  
> > [http://tfm.com.np](http://tfm.com.np)  
> > [http://nepalonrails.tumblr.com](http://nepalonrails.tumblr.com)  
> > Sent with Sparrow ([http://www.sparrowmailapp.com/?sig](http://www.sparrowmailapp.com/?sig))
