# Overriding node attributes with a wrapper cookbook

**URL:** <https://discourse.chef.io/t/overriding-node-attributes-with-a-wrapper-cookbook/5431>\
**Category:** Chef Infra (archive)\
**Created:** [June 20, 2014, 5:44pm UTC](https://discourse.chef.io/t/overriding-node-attributes-with-a-wrapper-cookbook/5431 "2014-06-20T17:44:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jay\_Reslock](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/jay_reslock/32/174_2.png) [@Jay\_Reslock](https://discourse.chef.io/u/Jay_Reslock)\
**Post date:** [June 20, 2014, 5:44pm UTC](https://discourse.chef.io/t/overriding-node-attributes-with-a-wrapper-cookbook/5431/1 "2014-06-20T17:44:50Z")

</div>

I’m hoping someone can help me figure this one out.

my\_wrapper\_cookbook depends on the community hadoop cookbook. Each recipe  
in the hadoop cookbook has an ‘include\_recipe hadoop::repo’ in order to set  
up the appropriate yum/apt repos for installation.

I want to use local repo mirrors to speed up the installation process  
because I’m installing hadoop clusters via automation to run testing every  
night. The installation process takes a long time.

I’m trying my\_cookbook -\> attributes -\> repos.rb and setting node.override  
there. These do not seem to be picked up when I converge the node.  
Instead, the attributes are being set via hadoop::repo for every recipe  
that is run since each recipe in the hadoop cookbook includes the repo  
recipe.

---

<div class="post-metadata">

**Author:** ![tknerr](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/tknerr/32/21_2.png) [@tknerr](https://discourse.chef.io/u/tknerr)\
**Post date:** [June 20, 2014, 7:43pm UTC](https://discourse.chef.io/t/overriding-node-attributes-with-a-wrapper-cookbook/5431/2 "2014-06-20T19:43:41Z")

</div>

Hi Jay,

try using `node.set['attr_name'] = 'value'` in your wrapper _recipe_ before  
you `include_recipe 'hadoop'`.

If the node attribute you are trying to set from the wrapper cookbook is  
used for computing other attributes in the hadoop cookbook you have to  
reload the hadoop attributes [0]

E.g. in `my_wrapper::default` recipe:

```auto
node.set['hadoop']['foo'] = 'bar'
node.from_file(run_context.resolve_attribute("hadoop", "default.rb"))
include_recipe 'hadoop::default'

```

HTH,  
Torben

[0]  
[http://docs.opscode.com/chef/essentials\_cookbook\_recipes.html#reload-attributes](http://docs.opscode.com/chef/essentials_cookbook_recipes.html#reload-attributes)

On Fri, Jun 20, 2014 at 7:44 PM, Jay Reslock [jreslock@gmail.com](mailto:jreslock@gmail.com) wrote:

> I'm hoping someone can help me figure this one out.
> 
> my\_wrapper\_cookbook depends on the community hadoop cookbook. Each recipe  
> in the hadoop cookbook has an 'include\_recipe hadoop::repo' in order to set  
> up the appropriate yum/apt repos for installation.
> 
> I want to use local repo mirrors to speed up the installation process  
> because I'm installing hadoop clusters via automation to run testing every  
> night. The installation process takes a long time.
> 
> I'm trying my\_cookbook -\> attributes -\> repos.rb and setting node.override  
> there. These do not seem to be picked up when I converge the node.  
> Instead, the attributes are being set via hadoop::repo for every recipe  
> that is run since each recipe in the hadoop cookbook includes the repo  
> recipe.
