Reputation: 6583
I would like to do something like this:
attributes/default.rb
if node[:chef_environment] == 'dev'
include_attribute "mbev::dev"
else
include_attribute "mbdev::production"
end
But it appears that 'node' is equal the name of the current node.
Upvotes: 4
Views: 6512
Reputation: 23
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.
Upvotes: 2
Reputation: 1053
Try node.chef_environment
? It's a function which returns the value rather than an attribute.
Upvotes: 8