我想做这样的事情:
属性/default.rb
if node[:chef_environment] == 'dev'
include_attribute "mbev::dev"
else
include_attribute "mbdev::production"
end
但似乎“节点”等于当前节点的名称。
我想做这样的事情:
属性/default.rb
if node[:chef_environment] == 'dev'
include_attribute "mbev::dev"
else
include_attribute "mbdev::production"
end
但似乎“节点”等于当前节点的名称。
试试node.chef_environment
?它是一个返回值而不是属性的函数。
Inside an attribute file, I think you want to use just chef_environment
, according to this post in the Chef Mailing List, and independently confirmed by me.
Your attribute file should then look like this:
if chef_environment == 'dev'
include_attribute "mbev::dev"
else
include_attribute "mbdev::production"
end
node.chef_environment
will work in recipes.