【发布时间】:2021-01-15 12:31:40
【问题描述】:
我正在尝试使用 Chef LWRP 下的目录资源,但无法访问资源块内的属性,有没有办法做到这一点。 还是我完全错了,需要不同的方法来实现这一点。
my-cookbook/providers/default.rb
use_inline_resources
action :setup do
directory node["#{@new_resource.name}"] do
action :create
not_if {node["#{@new_resource.name}"].include? "test"}
end
end
not_if {node["#{@new_resource.name}"].include? "test"} 行上的 @new_resource.name 被评估为 nilClass,
虽然它在directory node["#{@new_resource.name}"] do 行中得到正确评估
谢谢
【问题讨论】:
标签: chef-infra chef-recipe lwrp