# Template updated every chef run

**URL:** <https://discourse.chef.io/t/template-updated-every-chef-run/4660>\
**Category:** Chef Infra (archive)\
**Created:** [November 8, 2013, 5:56pm UTC](https://discourse.chef.io/t/template-updated-every-chef-run/4660 "2013-11-08T17:56:53Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Astlock](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/astlock/32/441_2.png) [@Astlock](https://discourse.chef.io/u/Astlock)\
**Post date:** [November 8, 2013, 5:56pm UTC](https://discourse.chef.io/t/template-updated-every-chef-run/4660/1 "2013-11-08T17:56:53Z")

</div>

Hi all. Just strange situation, can’t figure out.  
I have in attributes:

default[“grim”][“conf”][“max.value”] = nil  
default[“grim”][“conf”][“max.value.per.day”] = nil

in role:

default\_attributes(  
:grim =\> {  
“conf” =\> {  
“max.value.per.day” =\> 2  
}  
}  
)

in template:

\<% node[‘grim’][‘conf’].each do |attr| %\>  
\<% if !attr[1].nil? %\>  
\<%= “#{attr[0]} =” %\> \<%= “#{attr[1]}” %\>  
\<% end %\>  
\<% end %\>

* * *

- template[/home/user/my.conf] action create
  - update template[/home/user/my.conf] from e3b0c4 to c4a9ba  
— /home/user/my.conf 2013-11-08 17:18:10.000000000 +0000  
+++ /tmp/chef-rendered-template20131108-14338-13hq1u3 2013-11-08  
17:18:11.000000000 +0000  
@@ -0,0 +1 @@  
+max.value.per.day = 2

Chef Client finished, 3 resources updated

Why every chef run, I get the file update?

---

<div class="post-metadata">

**Author:** ![Astlock](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/astlock/32/441_2.png) [@Astlock](https://discourse.chef.io/u/Astlock)\
**Post date:** [November 10, 2013, 10:36pm UTC](https://discourse.chef.io/t/template-updated-every-chef-run/4660/2 "2013-11-10T22:36:05Z")

</div>

Uf, it's my inattention, just duplicated code in the separate recipes.

On Fri, Nov 8, 2013 at 7:56 PM, [nowarry@gmail.com](mailto:nowarry@gmail.com) wrote:

> Hi all. Just strange situation, can't figure out.  
> I have in attributes:
> 
> default["grim"]["conf"]["max.value"] = nil  
> default["grim"]["conf"]["max.value.per.day"] = nil
> 
> in role:
> 
> default\_attributes(  
> :grim =\> {  
> "conf" =\> {  
> "max.value.per.day" =\> 2  
> }  
> }  
> )
> 
> in template:
> 
> \<% node['grim']['conf'].each do |attr| %\>  
> \<% if !attr[1].nil? %\>  
> \<%= "#{attr[0]} =" %\> \<%= "#{attr[1]}" %\>  
> \<% end %\>  
> \<% end %\>
> 
> * * *
> 
> - template[/home/user/my.conf] action create
> - update template[/home/user/my.conf] from e3b0c4 to c4a9ba  
> --- /home/user/my.conf 2013-11-08 17:18:10.000000000 +0000  
> +++ /tmp/chef-rendered-template20131108-14338-13hq1u3 2013-11-08  
> 17:18:11.000000000 +0000  
> @@ -0,0 +1 @@  
> +max.value.per.day = 2
> 
> Chef Client finished, 3 resources updated
> 
> Why every chef run, I get the file update?
