我正在尝试更改使用windows_feature资源安装功能的IIS cookbook的默认行为。它位于如下循环中:
node['iis']['components'].each do |feature|
windows_feature feature do
action :install
end
end
我正在尝试使用包装器cookbook向此资源添加属性。如:
w = resource(:windows_feature => "feature")
w.source "path_to_source_files"
当然这不起作用因为"功能"没有定义。我该如何做到这一点?
答案 0 :(得分:0)
我找到了问题的答案。似乎如果烹饪书不允许灵活地调整资源的特定属性(即未使用/定义属性),那么您只需依靠烹饪书来访问其可用属性,但排除'include_recipe'
原创包装食谱:
metadata.rb
depends 'iis'
default.rb
include_recipe 'iis::default'
w = resource(:windows_feature => 'feature')
w.source 'path_to_source_files'
固定包装食谱:
metadata.rb
depends 'iis'
default.rb
node['iis']['components'].each do |feature|
windows_feature feature do
action :install
source 'path_to_source_files'
end
end