HomePhorge

(PUP-1699) Retain an instance of a Catalog's environment
882555579760Unpublished

Unpublished Commit ยท Learn More

Repository Importing: This repository is still importing.

Description

(PUP-1699) Retain an instance of a Catalog's environment

A catalog used to have the symbolic name if it's environment set, but
did not retain a reference to the actual environment instance. This
could would likely allow the catalog to reference it's original
environment for a legacy, memoized environment, but does not work with
newer cacheing models for directory environments. The problem was
showing up specifically in the
spec/integration/parser/ruby_manifest_spec which would compile a catalog
and then interrogate the catalog to see if it contained the expected
resources. Resources have unfortunate behavior causing them to lookup
environment in order to load types in support of the
Resource#parse_title. But the current_environment retrieved by the
resource in the spec was likely different than the one overridden during
compilation, and if it had never performed an initial import, might fail
attempting to lookup classes which were not on its path.

To short circuit some of this madness, the compiler is explicitly
setting a new Catalog#environment_instance, and Catalog#to_catalog is
ensuring that it copies when duplicating. Catalog#resource then
overrides current_environment to this instance.

Details

Event Timeline

Josh Partlow <joshua.partlow@puppetlabs.com> committed rPU882555579760: (PUP-1699) Retain an instance of a Catalog's environment (authored by Josh Partlow <joshua.partlow@puppetlabs.com>).Apr 28 2014, 11:04 PM