Chef infra 厨师长模板资源在每次运行时通知
我在食谱中有以下片段:Chef infra 厨师长模板资源在每次运行时通知,chef-infra,chef-recipe,Chef Infra,Chef Recipe,我在食谱中有以下片段: template "/mnt/application/config/pusher/#{port}.js" do owner "root" group "root" source "pusher/config.js.erb" mode "644" variables({ :directory => metricsDir, :host => host }) notifie
template "/mnt/application/config/pusher/#{port}.js" do
owner "root"
group "root"
source "pusher/config.js.erb"
mode "644"
variables({
:directory => metricsDir,
:host => host
})
notifies :run, "bash[restart pusher-#{port}]"
end
bash "restart pusher-#{port}" do
code "supervisorctl restart pusher-#{port}"
action :nothing
end
问题是bash操作每次都会运行,即使配置没有更改:
$ cp /mnt/application/config/pusher/50000.js ~/pre-run.js
$ chef-client
...
[Fri, 27 Sep 2013 09:49:03 +0000] INFO: template[/mnt/application/config/pusher/50000.js] sending run action to bash[restart pusher-50000] (delayed)
[Fri, 27 Sep 2013 09:49:03 +0000] INFO: Processing bash[restart pusher-50000] action run (shm::add_pusher line 96)
pusher-50000: stopped
pusher-50000: started
...
$ diff /mnt/application/config/pusher/50000.js ~/pre-run.js
$ echo $?
0
因此,配置保持不变,但操作仍被调用。如何修复此问题?显然,文件所有者已更改为0,如
-l debug
标志所示。文件的内容确实保持不变。显然,文件所有者已更改为0,如-l debug
标志所示。文件的内容确实保持不变。你能给出config.js.erb的内容吗?您还可以使用调试日志级别(chef client-l debug)运行chef客户端,因此如果内容没有更改,那么还有其他更改吗?请确保所有者、组和文件权限保持不变。谢谢,@kamaradclimber和@Draco Ater,确实是通过-l debug
我看到所有者正在更改。你能给出config.js.erb的内容吗?您还可以使用调试日志级别(chef client-l debug)运行chef客户端,因此如果内容没有更改,那么还有其他更改吗?请确保所有者、组和文件权限保持不变。谢谢,@kamaradclimber和@Draco Ater,确实是通过-l debug
我看到所有者正在更改。