- From: Jesse Nelson <
>
- To:
- Subject: [chef] Re: Scoping data bag items to environments
- Date: Tue, 16 Aug 2011 17:08:49 -0700
our hack has been to use a lookup for environment (this was pre
chef-environments) and chefs DeepMerge to basically get us environment bag
items that could be merged into a default bag item:
bags = data_bag( :jboss )
conf = data_bag_item( :jboss, node.jboss.cluster )['jboss']
if bags.include?( cluster_env )
conf = Chef::Mixin::DeepMerge.merge( conf, data_bag_item( :jboss,
cluster_env )['jboss'] )
end
so in jboss bag we have cluster1 and cluster1-dev which will override
cluster1 default bag item.
This has served us well.
On Aug 16, 2011, at 4:46 PM, Charles Duffy wrote:
>
Howdy --
>
>
Is there any support, either in code or by convention, for scoping data bag
>
items to environments?
>
>
Presuming that no explicit support exists (which is my current working
>
understanding), I've been thinking about appending the current environment
>
to the bag name for any data bags which are environment-specific. This
>
would seem like an advantage over putting the target environment in the bag
>
item name or in the JSON object's contents, by preventing the need for Chef
>
code to consider and explicitly exclude items not local to the active
>
environment.
>
>
Have others given thought to this subject?
>
>
Thanks!
Archive powered by MHonArc 2.6.16.