HomePhorge

(#13948) $libdir not in $LOAD_PATH
d936ddf5c84cUnpublished

Unpublished Commit ยท Learn More

Repository Importing: This repository is still importing.

Description

(#13948) $libdir not in $LOAD_PATH

Change :call_on_define to :call_hook with values of
:on_define_and_write, :on_initialize_and_write, and :on_write_only.
Make hooks for $libdir, $factpath, and $storeconfig new value of
:on_initialize_and_write to take advantage of bootstrapping sequence.
Change Puppet::Util::Settings to call hooks on settings designated as
:on_initialize_and_write immediately after initialing default
application values.
Deprecate Puppet::Util::Settings::StringSetting#call_on_define.

This change is backward compatible, although :call_on_define is
deprecated and should be changed to :call_hook => :on_define_and_write.
This change should also be forward compatible if we decide to call hooks
at other portions of the application bootstrapping lifecycle.

This commit fixes the problem that the default libdir was not being
added to Ruby's $LOAD_PATH properly.

Prior to this commit, the hooks for $libdir and $factpath were not
getting called unless explicitly overridden in the code. This meant that
the default $libdir was not part of $LOAD_PATH and the default $factpath
was not searched for facts. This commit fixes those problems by
enabling settings to declare when the hook should be called. A hook can
be only only when a value is overwritten (:on_write_only), which is the
default. A hook can be called with the default value when when the
setting is defined (as soon as Puppet::Util::Settings.define_settings is
called) (:on_define_and_write), in addition to any time the value is
overwritten. A hook can be called with the default value during
application initialization (:on_initialize_and_write), in addition to
any time the value is overwritten.

We've added the call to the initialize hooks in two places because we
have to deal with the bootstrapping of applications. We need to attempt
to parse command line options and the configuration file and call the
hooks. Then we need to do it again after the application is loaded
because it could very well have changed important things like $vardir,
which generally affects $libdir.

Details

Provenance
Jeff Weiss <jeff.weiss@puppetlabs.com>Authored on
vanmeeuwenPushed on Jun 2 2015, 2:22 PM
Parents
rPU32f91d11e149: Merge 'pluginsync-error' from pcarlisle
Branches
Unknown
Tags
Unknown

Event Timeline

Jeff Weiss <jeff.weiss@puppetlabs.com> committed rPUd936ddf5c84c: (#13948) $libdir not in $LOAD_PATH (authored by Jeff Weiss <jeff.weiss@puppetlabs.com>).Apr 25 2012, 7:38 AM