# Any plan for partial templates in Chef?

**URL:** <https://discourse.chef.io/t/any-plan-for-partial-templates-in-chef/3275>\
**Category:** Chef Infra (archive)\
**Created:** [November 11, 2012, 9:01pm UTC](https://discourse.chef.io/t/any-plan-for-partial-templates-in-chef/3275 "2012-11-11T21:01:59Z")\
**Posts on this page:** 2\
**Page:** 2

<div class="post-metadata">

**Author:** ![Andrea\_Campi](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/andrea_campi/32/514_2.png) [@Andrea\_Campi](https://discourse.chef.io/u/Andrea_Campi)\
**Post date:** [November 14, 2012, 10:54pm UTC](https://discourse.chef.io/t/any-plan-for-partial-templates-in-chef/3275/21 "2012-11-14T22:54:46Z")

</div>

My colleague raised another interesting points:

- do we want to propagate all variables from the template resource down to  
every partial?  
My guess is yes—I can’t really imagine a use case where you want to hide  
some from a partial. Overwrite it with a different value yes, but not block  
it. Right?

- I have never tried, but I assume it’s possible to assign a value to these  
variables in a template.  
We need to ensure that setting a variable in a partial does _not_ propagate  
up the chain.  
In other words, I need to #dup the context before sending it to a partial.

---

<div class="post-metadata">

**Author:** ![Bryan\_Berry](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/bryan_berry/32/213_2.png) [@Bryan\_Berry](https://discourse.chef.io/u/Bryan_Berry)\
**Post date:** [November 15, 2012, 7:17am UTC](https://discourse.chef.io/t/any-plan-for-partial-templates-in-chef/3275/22 "2012-11-15T07:17:17Z")

</div>

On Wed, Nov 14, 2012 at 11:54 PM, Andrea Campi \<[andrea.campi@zephirworks.com](mailto:andrea.campi@zephirworks.com)

> wrote:

> My colleague raised another interesting points:
> 
> - do we want to propagate all variables from the template resource down to  
> every partial?  
> My guess is yes—I can't really imagine a use case where you want to hide  
> some from a partial. Overwrite it with a different value yes, but not block  
> it. Right?
> 
> - I have never tried, but I assume it's possible to assign a value to  
> these variables in a template.  
> We need to ensure that setting a variable in a partial does _not_  
> propagate up the chain.  
> In other words, I need to #dup the context before sending it to a partial.

big yes on both points for me!

[Previous page](https://discourse.chef.io/t/any-plan-for-partial-templates-in-chef/3275.md?page=1)
