我编写了自己的提供程序,运行正常,例如:
my_custom_provider "#{node['ipaddress']}" do
my_attribute_1 node['ipaddress']
action :create
end
template '/opt/app/something.conf' do
mode '0664'
owner 'someuser'
group 'someuser'
notyfies :restart, "my_custom_provider[#{node['ipaddress']}]", :delayed
end
我收到错误(在chef-solo
下的Vagrant
下):
ERROR: resource template[/opt/app/something.conf] is configured to notify
resource my_custom_provider[10.0.2.15] with action restart, but
my_custom_provider[10.0.2.15] cannot be found in the resource collection.
template[/opt/app/something.conf] is defined in
/tmp/vagrant-chef/2a59b2477390af49acec413909d80cf5/cookbooks/project/recipes/default.rb:76:in `from_file'
但是,当我改变通知方向时,它可以正常工作:
my_custom_provider "#{node['ipaddress']}" do
my_attribute_1 node['ipaddress']
action :create
subscribes :restart, 'template[/opt/app/something.conf]', :delayed
end
template '/opt/app/something.conf' do
mode '0664'
owner 'someuser'
group 'someuser'
end
我认为这是chef-solo
下vagrant
运行的错误,或者我可能无法将自定义提供商添加为通知目标?
答案 0 :(得分:0)
要获取有关自定义LWRP的通知,您可能需要查看主厨文档https://docs.chef.io/lwrp_custom_provider.html#updated-by-last-action
中的示例