title: Attribute precedence in chef cookbook
body: <p>I am trying to implement a wrapper cookbook by taking inspiration from <a href="http://devopsanywhere.blogspot.in/2012/11/how-to-write-reusable-chef-cookbooks.html" rel="noreferrer">How to Write Reusable Chef Cookbooks, Gangnam Style</a>. I wish to install tomcat 7 on my node without manager app. I have created a wrapper cookbook with the following <code>attributes/default.rb</code> file:</p>
  
  <pre><code>default["tomcat"]["base_version"] = 7
  default["tomcat"]["deploy_manager_apps"] = false
  </code></pre>
  
  <p>The default attributes provided in <code>tomcat/attributes/default.rb</code> are:</p>
  
  <pre><code>default["tomcat"]["base_version"] = 6
  #other attributes
  default["tomcat"]["deploy_manager_apps"] = true
  default["tomcat"]["user"] = "tomcat#{node["tomcat"]["base_version"]}
  </code></pre>
  
  <p>I wish to override these values across all attributes. However attributes such as <code>["tomcat"]["user"]</code> are not getting overriden. The above still has the value of <code>tomcat6</code> in <code>node["tomcat"]["user"]</code>. </p>
  
  <p>Do I have to override all the attributes which refer to <code>["tomcat"]["base_version"]}"</code>? If my <code>attributes/default.rb</code> were loaded before tomcat cookbook's <code>default.rb</code> this would have worked fine. </p>
  
  <p>I am using Berkshelf, Vagrant and Chef solo for development. In <code>metadata.rb</code> of my cookbook, I have mentioned <code>depends "tomcat"</code>. </p>
  
  <p>My custom cookbook is located at <a href="https://github.com/vaibhavguptaIITD/hcentive-ops/tree/master/hc-tomcat" rel="noreferrer">https://github.com/vaibhavguptaIITD/hcentive-ops/tree/master/hc-tomcat</a> and tomcat community cookbook is located at <a href="https://github.com/opscode-cookbooks/tomcat" rel="noreferrer">https://github.com/opscode-cookbooks/tomcat</a>.</p>