puppetlabs/puppet — pull request #2587 by zaphod42 (2014-04-26 01:09:50+00:00)
Title: (PUP-2344) Fix issue with inter-module calls (visibility error)

This fixes the problem where inter-module function calls could not be
made. The main problem was that a function when loaded was given the
public loader and thus had no visibility into its containing module's
dependencies.

The design is that module resolution should be on-demand, only when
something actually needs the proviate loader should it be resolved. The
resolution is triggered by asking for the private loader, but no such
call was made on the call-path when a function was loaded.

This commit adds the notion of private_loader to the loaders (those that
do not have one respond with self). Those that do either provide the
private loader explicitly (environment loader), or on demand (by obtaining
the private loader from loaders).

This change required tests to be modified since the logic now depends on
:loaders being bound in the Puppet context logic that made this happen on
demand was not implemented