- From: AJ Christensen <
>
- To:
- Subject: [chef] Re: out-of-the-box chef-client cookbook has no interval dial
- Date: Fri, 7 Oct 2011 13:58:39 +1300
Yo,
On 7 October 2011 13:55,
<
>
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
>
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
>
>
>
>
>
Archive powered by MHonArc 2.6.16.