我的食谱中有以下片段:
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 :(得分:1)
显然,-l debug
标志显示文件所有者已更改为0。文件的内容确实保持不变。