[英]chef definition taking a list of arguments
How do I pass a list of attributes to a chef definition? 如何将属性列表传递给厨师定义?
Below is a code-snippit (not complete). 下面是一个代码段(不完整)。 The offending part is indicated with # ??.
令人反感的部分用#??表示。
define :yum_local_package, :notifies => nil do
yum_package params[:name] do
notifies *params[:notifies] # ??
end
end
I expect: 我预计:
yum_local_package my_package do
notifies :restart, "service[myservice]", :delayed
end
to simply forward the "notifies" parameters. 简单地转发“通知”参数。
You would have to make it an actual array: 您必须将其设置为实际数组:
yum_local_package my_package do
notifies [:restart, "service[myservice]", :delayed]
end
In related news, you should really use LWRPs for stuff like this as then you don't need any of this tomfoolery with notifications. 在相关新闻中,您应该对这样的东西真正使用LWRP,因为这样您就不需要带有通知的虚假信息。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.