Thanks Luke.
For me, being able to determine the agent environment is very useful.
We use git for the Puppet manifests and each branch is an environment.
So we'll create new branches to test and deploy new features.
Then when it's ready to go live to all nodes, we'll merge that branch back into master and remove the feature branch.
I rely on being able to query puppetdb or puppet-dashboard to find out which nodes are using environment X, so I can safely remove a branch once there are no nodes using it.
We also manage Puppet with Puppet and set the environment in puppet.conf based on the current environment. This does still work as the environment is available in the manifests.
Including it here in case it's useful to others.
require 'puppet'
Facter.add('environment') do
setcode do
Puppet[:environment]
end
end
J