Question

I've got a recipe that should install a template, and then restart the service...

service "rsyslog" do
  supports :restart => true, :reload => true
  action [:enable, :start]
end 

Chef::Log.info("Creating loggly rsyslog conf")
template "/etc/rsyslog.d/22-loggly.conf" do
  source "syslogd.conf.erb"
  mode "0755"
  owner "root"
  group "root"
  notifies :restart, resources(:service => "rsyslog")
end

Why am I getting:

ERROR: resource template[/etc/rsyslog.d/22-loggly.conf] is configured to notify resource service['rsyslog'] with action restart, but service['rsyslog'] cannot be found in the resource collection. template[/etc/rsyslog.d/22-loggly.conf] is defined in /home/ubuntu/cookbooks/loggly-syslog/recipes/default.rb:7:in `from_file'

[2014-01-03T23:26:37+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)

How can I make rsyslog restart/reload after I add the config file??

Was it helpful?

Solution

You are using the old notification syntax. Switch to the new syntax:

template '...' do
  notifies :restart, 'service[rsyslog]'
end
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top