厨师“通知”无法重新启动或重新加载服务

Joh*_*ebs 5 ubuntu chef chef-solo ubuntu-12.04

我正在使用 Chef-solo v10.12.0 来配置 Ubuntu 12.04 VM,但我一直遇到一个问题,即在更改配置文件时服务无法按预期重新启动或重新加载。

日志中没有错误,尽管它显然在执行配方中的所有其他操作。作为一种解决方法,我一直在手动重新启动服务或在每次执行配方时强制重新加载/重新启动,但我更愿意弄清楚出了什么问题并使其按预期工作。

一个始终无法按预期工作的示例配方:

package "pgbouncer"

cookbook_file "/etc/default/pgbouncer" do
    source "pgbouncer/pgbouncer"
    owner "root"
    group "root"
    mode 0644
end

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

cookbook_file "/etc/pgbouncer/userlist.txt" do
    source "pgbouncer/userlist.txt"
    owner "postgres"
    group "postgres"
    mode 0640
    notifies :restart, "service[pgbouncer]"
end

template "/etc/pgbouncer/pgbouncer.ini" do
    source "pgbouncer/pgbouncer.ini"
    owner "postgres"
    group "postgres"
    mode 0640
    variables :postgres_host => node[:postgres_host]
    notifies :restart, "service[pgbouncer]"
end
Run Code Online (Sandbox Code Playgroud)

Mik*_*ler 0

一般来说,这似乎是资源和通知的一个相当普遍的问题。

我浏览了 Opscode JIRA 票证跟踪器,有一张票证讨论了通知和资源行为的大量更改和修复,将于 10.14.0 中发布