我有一个名为的厨师LWRP(pleaserun
):
pleaserun service_name do
program executable_path
args args if args
user service_user
group service_group
description service_name
action :create
notifies :start, "service[#{service_name}]"
end
我已经做到这一点,以便优悦运营商实际检查是否有任何更新。如果有任何更新,new_resource.updated_by_last_action
设置为true
,否则设置为false
:
action :create do
converge_by("Create #{ @new_resource }") do
result = please_run_me
Chef::Log.info "+++++ result: #{result.inspect}"
new_resource.updated_by_last_action(result)
end
end
但无论new_resource.updated_by_last_action
是true
还是false
,都会通知火警并执行service[#{service_name}]
(来自chef-client运行日志):
INFO: +++++ result: false
...
INFO: pleaserun[ep-terminator] sending start action to service[ep-terminator] (delayed)
我在有use_inline_resources
的情况下尝试过它
我正在运行Chef-client 12.2.1
我错过了什么吗?
完整代码位于chef-pleaserun/providers/default.rb rberger/make_idempotent branch