【问题标题】:Chef 12.0.3: Why I can't find my own provider on Resource Collection?Chef 12.0.3:为什么我在 Resource Collection 上找不到我自己的提供者?
【发布时间】:2015-03-13 03:38:08
【问题描述】:

我自己编写了运行良好的提供程序,例如:

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

我收到错误(在Vagrant 中的chef-solo 下):

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

我认为这是在vagrant 下运行的chef-solo 中的一个错误,或者我无法将自定义提供程序添加为通知目标?

【问题讨论】:

  • 之前没有警告吗?你能分享你的 LWRP 或 HWRP 代码吗?

标签: vagrant chef-infra chef-solo


【解决方案1】:

要获取有关您的自定义 LWRP 的通知,您可能需要查看厨师文档https://docs.chef.io/lwrp_custom_provider.html#updated-by-last-action 中的示例

【讨论】:

    猜你喜欢
    • 2017-03-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-06-08
    • 1970-01-01
    • 2021-06-18
    • 2016-11-18
    • 1970-01-01
    相关资源
    最近更新 更多