puppetlabs/puppet — pull request #2596 by jpartlow (2014-04-30 00:31:48+00:00)
Title: (PUP-1699) Ensure context in effect before accessing in app setup

Discovered that the environment that was going to be created using the
commandline overrides would be incorrect when the application's run mode
was not user. This happened because it was using a new loader before
that loader was put into the context, which cause the settings to be
read incorrectly. The cacheing played into this because that incorrect
environment, without cacheing gets thrown away, but with cacheing
persisted into the actual catalog requests if they were made within the
timeout period.

To fix this we override with a preliminary context to ensure that
we are reading settings in the current run mode, before overriding with
the final current environment.

Paired-with: Andrew Parker