我有一个应该安装模板的配方,然后重新启动服务......

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

为什么我得到:
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)

添加配置文件后,如何使 rsyslog 重新启动/重新加载?

最佳答案

您正在使用旧的通知语法。切换到新语法:

template '...' do
  notifies :restart, 'service[rsyslog]'
end

关于chef-infra - 重新启动 rsyslog 的厨师配方,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/20914633/

10-12 17:50