puppetlabs/puppet — pull request #1455 by domcleal (2013-02-06 17:09:03+00:00)
Title: (#18187) Clear *root* environment when clearing caches

When changing settings or initializing Puppet via TestHelper, the
Puppet::Node::Environment.clear method is called to delete the cached
environment objects, as they may reference cached module paths based on old
values of settings.

The *root* environment is a special case, as it acts as the current environment
when no other environment has been created and set yet. It can still have a
module path based on current settings, so it too should be cleared along with
other cached environments.

This was an issue in 2.7.x in particular, where *root* would be used usually.
In later versions, app_defaults_initialized? prevents *root* from being used
too early.