puppetlabs/puppet — pull request #2554 by jpartlow (2014-04-18 21:36:34+00:00)
Title: (PUP-2213) Read environment settings from other sections in config print

Puppet's config print functionality has a --section option to allow you
to read the configuration as it would be seen in other run modes such as
master or agent. But the environment loaders are provided an
environmentpath and basemodulepath setting prior to Puppet evaluating
the user's --section setting, and will only provide environments as
configured in [main]. So if you have environmentpath set in master, a
`puppet config print modulepath --section master --environment
production` would show you the modulepath for the production
environment as loaded from [main] not [master].

To fix this, when handling a config print call, we are now overriding
the environment loaders with settings obtained from the user selected
section. This means that the interpolated settings can now find an
environment from an environmentpath specified in any section of
puppet.conf.

The static environment loader get_conf() method is also changed to
return a simple configuration that just returns the statically declared
environment's settings. This ensures that `puppet config print
--environment doesnotexist` will correctly print the 'no_manifest' and
empty modulepath setting that reflect the private statically configured
environment settings for a non-existent directory environment.