So what you would do is you would have your main policyfile for example master_policy.rb
Within master_policy.rb you would define your run_list, named_run_list and the default attributes for all instances.
As part of the run_list and named_run_list that you define you need to add the “poise_hoist” cookbook at the very start of the run_list definition.
Then create a folder called env_attributes and in this folder I will create “env1_attributes.rb”. This will be the ruby file that defines all of the default attributes that need to be different for the “env1” environment. You need to make sure that you always specify [‘env1’] as the first attribute for any attributes that you want to override. For example
default['env1']['cookbook']['deviceid'] = 12
Now in order to load this file as part of the "chef update " you need to put is these lines:
env1_path = File.expand_path('../env_attributes/env1_attributes.rb', __FILE__) instance_eval(IO.read(env1_path))
This will inject the contents of the env1_attributes.rb into the master_policy.rb.
Next you just need to make sure you client.rb has the policy_group defined correctly. Essentially what the poise-hoist cookbook does is it looks at the policy_group your running with “env1” and remove that level of the hierarchy and remaps all values. Therefore you end up with the default[‘env1’][‘cookbook’][‘deviceid’] => default[‘cookbook’][‘deviceid’]
Hope that helps