# Out-of-the-box chef-client cookbook has no interval dial

**URL:** <https://discourse.chef.io/t/out-of-the-box-chef-client-cookbook-has-no-interval-dial/2165>\
**Category:** Chef Infra (archive)\
**Created:** [October 7, 2011, 12:55am UTC](https://discourse.chef.io/t/out-of-the-box-chef-client-cookbook-has-no-interval-dial/2165 "2011-10-07T00:55:22Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kallen](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/kallen/32/1049_2.png) [@Kallen](https://discourse.chef.io/u/Kallen)\
**Post date:** [October 7, 2011, 12:55am UTC](https://discourse.chef.io/t/out-of-the-box-chef-client-cookbook-has-no-interval-dial/2165/1 "2011-10-07T00:55:22Z")

</div>

hiya,

at this point in my chef infancy i’m under the impression that i should  
be able to use community cookbooks as is for basic functionality, and  
shouldn’t generally need to modify them. if i need to modify attributes,  
i do that in an attribute override.

i’m trying to do that for the chef-client interval. it defaults to  
1800 in the cookbook’s default attributes. i have an override in my  
base role:

[chefrepo]$ knife role show base -a override\_attributes  
override\_attributes:  
chef\_client:  
init\_style: init  
interval: 21600  
server\_url: [https://chef.dev.blueangelsinmypance.com](https://chef.dev.blueangelsinmypance.com)  
validation\_client\_name: chef-validator

(yes, i’ll go with 1800 interval at a later time in my deployment.)

but this isn’t working - an interval line in my client’s config doesn’t  
appear. i’m pretty sure the reason is because there is no interval  
line in the template:

```
cookbooks/chef-client/templates/default/client.rb.erb

```

should i modify that template or is there a better "best practices"  
way to handle this?

and so, i go ahead and add a line to that template, run the client,  
and get an error…

my change:

— client.rb.erb 2011-10-07 00:53:10.000000000 +0000  
+++ client.rb.erb.new 2011-10-07 00:53:03.000000000 +0000  
@@ -13,6 +13,7 @@

# Using default node name

\<% end -%\>

+interval "\<%= node[“chef\_client”][“interval”] %\>"  
file\_backup\_path "\<%= node[“chef\_client”][“backup\_path”] %\>"  
file\_cache\_path “\<%= node[“chef\_client”][“cache\_path”] %\>”

the error on the client:

[Fri, 07 Oct 2011 00:41:54 +0000] INFO: template[/etc/chef/client.rb] sending create action to ruby\_block[reload\_client\_config] (delayed)  
[Fri, 07 Oct 2011 00:41:54 +0000] INFO: Processing ruby\_block[reload\_client\_config] action create (chef-client::config line 48)  
[Fri, 07 Oct 2011 00:41:54 +0000] INFO: ruby\_block[reload\_client\_config] called  
[Fri, 07 Oct 2011 00:41:54 +0000] INFO: template[/etc/sysconfig/chef-client] sending restart action to service[chef-client] (delayed)  
[Fri, 07 Oct 2011 00:41:54 +0000] INFO: Processing service[chef-client] action restart (chef-client::service line 73)  
[Fri, 07 Oct 2011 00:42:00 +0000] INFO: service[chef-client] restarted  
[Fri, 07 Oct 2011 00:42:00 +0000] INFO: Chef Run complete in 63.332668 seconds  
[Fri, 07 Oct 2011 00:42:00 +0000] INFO: Running report handlers  
[Fri, 07 Oct 2011 00:42:00 +0000] INFO: Report handlers complete  
[Fri, 07 Oct 2011 00:42:00 +0000] ERROR: TypeError: can’t convert String into time interval  
[Fri, 07 Oct 2011 00:42:00 +0000] FATAL: Stacktrace dumped to /var/cache/chef/chef-stacktrace.out  
[Fri, 07 Oct 2011 00:42:00 +0000] ERROR: Sleeping for 21600 seconds before trying again  
/usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/…/lib/chef/application/client.rb:282:in `select': can't convert String into time interval (TypeError) from /usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/application/client.rb:282:in`client\_sleep’  
from /usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/…/lib/chef/application/client.rb:263:in `run_application' from /usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/application/client.rb:229:in`loop’  
from /usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/…/lib/chef/application/client.rb:229:in `run_application' from /usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/application.rb:67:in`run’  
from /usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/chef-client:26  
from /usr/bin/chef-client:19:in `load’  
from /usr/bin/chef-client:19

halp? thanks!

kallen

---

<div class="post-metadata">

**Author:** ![AJ\_Christensen](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/aj_christensen/32/525_2.png) [@AJ\_Christensen](https://discourse.chef.io/u/AJ_Christensen)\
**Post date:** [October 7, 2011, 12:58am UTC](https://discourse.chef.io/t/out-of-the-box-chef-client-cookbook-has-no-interval-dial/2165/2 "2011-10-07T00:58:39Z")

</div>

Yo,

On 7 October 2011 13:55, [kallen@groknaut.net](mailto:kallen@groknaut.net) wrote:

> hiya,
> 
> at this point in my chef infancy i'm under the impression that i should  
> be able to use community cookbooks as is for basic functionality, and  
> shouldn't generally need to modify them. if i need to modify attributes,  
> i do that in an attribute override.
> 
> i'm trying to do that for the chef-client interval. it defaults to  
> 1800 in the cookbook's default attributes. i have an override in my  
> base role:
> 
> [chefrepo]$ knife role show base -a override\_attributes  
> override\_attributes:  
> chef\_client:  
> init\_style: init  
> interval: 21600  
> server\_url: [https://chef.dev.blueangelsinmypance.com](https://chef.dev.blueangelsinmypance.com)  
> validation\_client\_name: chef-validator
> 
> (yes, i'll go with 1800 interval at a later time in my deployment.)
> 
> but this isn't working - an interval line in my client's config doesn't  
> appear. i'm pretty sure the reason is because there is no interval  
> line in the template:
> 
> cookbooks/chef-client/templates/default/client.rb.erb

Sounds like a bug in the cookbook.

> should i modify that template or is there a better "best practices"  
> way to handle this?

You could modify the template locally, open a ticket on the COOK  
project, and/or supply the fix!

> and so, i go ahead and add a line to that template, run the client,  
> and get an error..
> 
> my change:
> 
> --- client.rb.erb 2011-10-07 00:53:10.000000000 +0000  
> +++ client.rb.erb.new 2011-10-07 00:53:03.000000000 +0000  
> @@ -13,6 +13,7 @@
> 
> # Using default node name
> 
> \<% end -%\>
> 
> +interval "\<%= node["chef\_client"]["interval"] %\>"

Unfortunately, interval takes an integer - not a string. use:

interval \<%= node["chef\_client"]["interval"].to\_i %\>

Regards,

–AJ

> file\_backup\_path "\<%= node["chef\_client"]["backup\_path"] %\>"  
> file\_cache\_path "\<%= node["chef\_client"]["cache\_path"] %\>"
> 
> the error on the client:
> 
> [Fri, 07 Oct 2011 00:41:54 +0000] INFO: template[/etc/chef/client.rb] sending create action to ruby\_block[reload\_client\_config] (delayed)  
> [Fri, 07 Oct 2011 00:41:54 +0000] INFO: Processing ruby\_block[reload\_client\_config] action create (chef-client::config line 48)  
> [Fri, 07 Oct 2011 00:41:54 +0000] INFO: ruby\_block[reload\_client\_config] called  
> [Fri, 07 Oct 2011 00:41:54 +0000] INFO: template[/etc/sysconfig/chef-client] sending restart action to service[chef-client] (delayed)  
> [Fri, 07 Oct 2011 00:41:54 +0000] INFO: Processing service[chef-client] action restart (chef-client::service line 73)  
> [Fri, 07 Oct 2011 00:42:00 +0000] INFO: service[chef-client] restarted  
> [Fri, 07 Oct 2011 00:42:00 +0000] INFO: Chef Run complete in 63.332668 seconds  
> [Fri, 07 Oct 2011 00:42:00 +0000] INFO: Running report handlers  
> [Fri, 07 Oct 2011 00:42:00 +0000] INFO: Report handlers complete  
> [Fri, 07 Oct 2011 00:42:00 +0000] ERROR: TypeError: can't convert String into time interval  
> [Fri, 07 Oct 2011 00:42:00 +0000] FATAL: Stacktrace dumped to /var/cache/chef/chef-stacktrace.out  
> [Fri, 07 Oct 2011 00:42:00 +0000] ERROR: Sleeping for 21600 seconds before trying again  
> /usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/application/client.rb:282:in `select': can't convert String into time interval (TypeError) from /usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/application/client.rb:282:in `client\_sleep'  
> from /usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/application/client.rb:263:in `run_application' from /usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/application/client.rb:229:in `loop'  
> from /usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/application/client.rb:229:in `run_application' from /usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/application.rb:67:in `run'  
> from /usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/chef-client:26  
> from /usr/bin/chef-client:19:in `load'  
> from /usr/bin/chef-client:19
> 
> halp? thanks!
> 
> kallen

---

<div class="post-metadata">

**Author:** ![Kallen](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/kallen/32/1049_2.png) [@Kallen](https://discourse.chef.io/u/Kallen)\
**Post date:** [October 7, 2011, 1:22am UTC](https://discourse.chef.io/t/out-of-the-box-chef-client-cookbook-has-no-interval-dial/2165/3 "2011-10-07T01:22:16Z")

</div>

On Fri, 07 Oct 2011, AJ Christensen wrote:

> Yo,
> 
> > cookbooks/chef-client/templates/default/client.rb.erb
> 
> Sounds like a bug in the cookbook.
> 
> > should i modify that template or is there a better "best practices"  
> > way to handle this?
> 
> You could modify the template locally, open a ticket on the COOK  
> project, and/or supply the fix!

will do.

> Unfortunately, interval takes an integer - not a string. use:
> 
> interval \<%= node["chef\_client"]["interval"].to\_i %\>

i just tried that.. still getting error. i definately appreciate the  
help here via mailing list, but let me know if i should just head over  
to opscode jira..

the top 3 lines of that client.rb.erb are now:  
log\_level :info  
log\_location STDOUT  
interval "\<%= node["chef\_client"]["interval"].to\_i %\>"

uploaded the cookbook.

still getting an error.

[Fri, 07 Oct 2011 01:12:59 +0000] ERROR: TypeError: can't convert String into time interval  
[Fri, 07 Oct 2011 01:12:59 +0000] FATAL: Stacktrace dumped to /var/cache/chef/chef-stacktrace.out  
[Fri, 07 Oct 2011 01:12:59 +0000] ERROR: Sleeping for 21600 seconds before trying again  
/usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/application/client.rb:282:in `select': can't convert String into time interval (TypeError) from /usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/application/client.rb:282:in `client\_sleep'  
from /usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/application/client.rb:263:in `run_application' from /usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/application/client.rb:229:in `loop'  
from /usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/application/client.rb:229:in `run_application' from /usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/application.rb:67:in `run'  
from /usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/chef-client:26  
from /usr/bin/chef-client:19:in `load'  
from /usr/bin/chef-client:19

10/07 01:12[root@test-dev ~]# head -3 /etc/chef/client.rb  
log\_level :info  
log\_location STDOUT  
interval "21600"

thoughts?

for shizzles i've tried both

```
  "interval": "21600",

```

and

```
  "interval": 21600,

```

in my override, like:  
"override\_attributes": {  
"chef\_client": {  
"init\_style": "init",  
"interval": "21600",  
"server\_url": "[https://chef.dev.sushimysavior.com](https://chef.dev.sushimysavior.com)",  
"validation\_client\_name": "chef-validator"  
}  
}

---

<div class="post-metadata">

**Author:** ![AJ\_Christensen](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/aj_christensen/32/525_2.png) [@AJ\_Christensen](https://discourse.chef.io/u/AJ_Christensen)\
**Post date:** [October 7, 2011, 1:24am UTC](https://discourse.chef.io/t/out-of-the-box-chef-client-cookbook-has-no-interval-dial/2165/4 "2011-10-07T01:24:47Z")

</div>

Yo,

On 7 October 2011 14:22, [kallen@groknaut.net](mailto:kallen@groknaut.net) wrote:

> On Fri, 07 Oct 2011, AJ Christensen wrote:
> 
> > Yo,
> > 
> > > cookbooks/chef-client/templates/default/client.rb.erb
> > 
> > Sounds like a bug in the cookbook.
> > 
> > > should i modify that template or is there a better "best practices"  
> > > way to handle this?
> > 
> > You could modify the template locally, open a ticket on the COOK  
> > project, and/or supply the fix!
> 
> will do.
> 
> > Unfortunately, interval takes an integer - not a string. use:
> > 
> > interval \<%= node["chef\_client"]["interval"].to\_i %\>
> 
> i just tried that.. still getting error. i definately appreciate the  
> help here via mailing list, but let me know if i should just head over  
> to opscode jira..
> 
> the top 3 lines of that client.rb.erb are now:  
> log\_level :info  
> log\_location STDOUT  
> interval "\<%= node["chef\_client"]["interval"].to\_i %\>"
> 
> uploaded the cookbook.
> 
> still getting an error.
> 
> [Fri, 07 Oct 2011 01:12:59 +0000] ERROR: TypeError: can't convert String into time interval  
> [Fri, 07 Oct 2011 01:12:59 +0000] FATAL: Stacktrace dumped to /var/cache/chef/chef-stacktrace.out  
> [Fri, 07 Oct 2011 01:12:59 +0000] ERROR: Sleeping for 21600 seconds before trying again  
> /usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/application/client.rb:282:in `select': can't convert String into time interval (TypeError) from /usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/application/client.rb:282:in `client\_sleep'  
> from /usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/application/client.rb:263:in `run_application' from /usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/application/client.rb:229:in `loop'  
> from /usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/application/client.rb:229:in `run_application' from /usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/application.rb:67:in `run'  
> from /usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/chef-client:26  
> from /usr/bin/chef-client:19:in `load'  
> from /usr/bin/chef-client:19
> 
> 10/07 01:12[root@test-dev ~]# head -3 /etc/chef/client.rb  
> log\_level :info  
> log\_location STDOUT  
> interval "21600"

Still getting rendered as a string here. You want that to appear as:

interval 21600

Please paste the relevant contents of your client.erb template.

Cheers,

–AJ

> thoughts?
> 
> for shizzles i've tried both
> 
> ```
> "interval": "21600",
> 
> ```
> 
> and
> 
> ```
> "interval": 21600,
> 
> ```
> 
> in my override, like:  
> "override\_attributes": {  
> "chef\_client": {  
> "init\_style": "init",  
> "interval": "21600",  
> "server\_url": "[https://chef.dev.sushimysavior.com](https://chef.dev.sushimysavior.com)",  
> "validation\_client\_name": "chef-validator"  
> }  
> }

---

<div class="post-metadata">

**Author:** ![Kallen](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/kallen/32/1049_2.png) [@Kallen](https://discourse.chef.io/u/Kallen)\
**Post date:** [October 7, 2011, 1:27am UTC](https://discourse.chef.io/t/out-of-the-box-chef-client-cookbook-has-no-interval-dial/2165/5 "2011-10-07T01:27:37Z")

</div>

On Fri, 07 Oct 2011, AJ Christensen wrote:

> Yo,
> 
> Still getting rendered as a string here. You want that to appear as:
> 
> interval 21600
> 
> Please paste the relevant contents of your client.erb template.

[cheftain01]$ pwd  
/home/kallen/sbox/ops/chef-repo/cookbooks/chef-client/templates/default

[cheftain01]$ head client.rb.erb  
log\_level :info  
log\_location STDOUT  
interval "\<%= node["chef\_client"]["interval"].to\_i %\>"

\<% if Chef::Config.has\_key?(:chef\_server\_url) -%\>  
chef\_server\_url "\<%= Chef::Config[:chef\_server\_url] %\>"  
\<% else -%\>  
chef\_server\_url "\<%= node["chef\_client"]["server\_url"] %\>"  
\<% end -%\>  
validation\_client\_name "\<%= node["chef\_client"]["validation\_client\_name"] %\>"

---

<div class="post-metadata">

**Author:** ![AJ\_Christensen](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/aj_christensen/32/525_2.png) [@AJ\_Christensen](https://discourse.chef.io/u/AJ_Christensen)\
**Post date:** [October 7, 2011, 1:36am UTC](https://discourse.chef.io/t/out-of-the-box-chef-client-cookbook-has-no-interval-dial/2165/6 "2011-10-07T01:36:06Z")

</div>

Yo,

On 7 October 2011 14:27, [kallen@groknaut.net](mailto:kallen@groknaut.net) wrote:

> On Fri, 07 Oct 2011, AJ Christensen wrote:
> 
> > Yo,
> > 
> > Still getting rendered as a string here. You want that to appear as:
> > 
> > interval 21600
> > 
> > Please paste the relevant contents of your client.erb template.
> 
> [cheftain01]$ pwd  
> /home/kallen/sbox/ops/chef-repo/cookbooks/chef-client/templates/default
> 
> [cheftain01]$ head client.rb.erb  
> log\_level :info  
> log\_location STDOUT

Ahh..

> interval "\<%= node["chef\_client"]["interval"].to\_i %\>"

Word, this line is bad. You want it to look like:

interval \<%= node["chef\_client"]["interval"].to\_i %\>

Per my original email, without any extra double quotes. 🙂

–AJ

> \<% if Chef::Config.has\_key?(:chef\_server\_url) -%\>  
> chef\_server\_url "\<%= Chef::Config[:chef\_server\_url] %\>"  
> \<% else -%\>  
> chef\_server\_url "\<%= node["chef\_client"]["server\_url"] %\>"  
> \<% end -%\>  
> validation\_client\_name "\<%= node["chef\_client"]["validation\_client\_name"] %\>"

---

<div class="post-metadata">

**Author:** ![Kallen](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/kallen/32/1049_2.png) [@Kallen](https://discourse.chef.io/u/Kallen)\
**Post date:** [October 7, 2011, 3:11am UTC](https://discourse.chef.io/t/out-of-the-box-chef-client-cookbook-has-no-interval-dial/2165/7 "2011-10-07T03:11:21Z")

</div>

On Fri, 07 Oct 2011, AJ Christensen wrote:

> > [cheftain01]$ pwd  
> > /home/kallen/sbox/ops/chef-repo/cookbooks/chef-client/templates/default
> > 
> > [cheftain01]$ head client.rb.erb  
> > log\_level :info  
> > log\_location STDOUT
> 
> Ahh..
> 
> > interval "\<%= node["chef\_client"]["interval"].to\_i %\>"
> 
> Word, this line is bad. You want it to look like:
> 
> interval \<%= node["chef\_client"]["interval"].to\_i %\>
> 
> Per my original email, without any extra double quotes. 🙂

ahoy! that worked. thanks!

also opened a bug to add that to the cookbook:  
[http://tickets.opscode.com/browse/COOK-784](http://tickets.opscode.com/browse/COOK-784)
