Issue #13948 has been updated by Jeff Weiss.

By the way, it would appear that `factpath` suffers the same problem, although 
it's maybe not as high profile as `libdir`.

I think a reasonable place to ensure these hooks are called is right after the 
application defaults are set.  If you have a setting, like `libdir`, where the 
hook uses the interpolated value (like appending the `$LOAD_PATH`) and the 
uninterpolated value depends on an application default setting (`$vardir` in 
this case), you want to make sure that 1) the hook is called after `$vardir` 
has been set to the proper value, and 2) minimize the time between application 
default setting and hook call to ensure all portions of the application use the 
correct `libdir` or `factpath`

Depending on how faces are bootstrapped, it's possible that we might also need 
to call the hooks prior to initializing application defaults so that the faces 
can be found and then initialized with their settings for `$vardir`.  In that 
case, should the face application replace the `$libdir` of the bootstrapping 
sequence (with might happen with the hook code with `@oldlibdir`, I need to 
verify) or append its own `$libdir` setting to the `$LOAD_PATH`.

Also is appending to the `$LOAD_PATH` what we want?  I would think that we'd 
want to prepend to the `$LOAD_PATH`...
----------------------------------------
Bug #13948: libdir does not always get added to LOAD_PATH
https://projects.puppetlabs.com/issues/13948#change-61199

Author: Chris Price
Status: Accepted
Priority: Urgent
Assignee: Jeff Weiss
Category: Faces
Target version: Telly
Affected Puppet version: 
Keywords: apps faces pluginsync
Branch: 


There is a hook for the libdir setting that causes it to be added to the ruby 
LOAD_PATH whenever a value is assigned to it.  Without this hook being 
triggered, puppet won't be able to locate faces and applications correctly.

This is problematic if the user's configuration leaves libdir set to its 
default value of "$vardir/lib"; in this case it never gets explicitly assigned, 
and thus the hook will never be called.

This worked OK in 2.7.x because the libdir setting used ":call_on_define", 
which meant that the hook would always get called at the time that the setting 
was defined.  However, in Telly, certain settings (including libdir) MUST not 
be initialized at definition time--doing so introduces very confusing and 
problematic ordering issues whereby you have to be very careful about what 
point in the application lifecycle you are able to call "require 'puppet'".  
Therefore, we no longer use :call_on_define for libdir.

To repro this, just pluginsync or copy a module that contains an app or face 
into your local $vardir/lib, and then run 'puppet help' without explicitly 
specifying 'libdir'.  Your app/face will not show up in the help list.

Possible fixes:

1) There is a spot in the code (probably in Settings#set_value or something 
called from in there) that will detect that we don't currently have a cached, 
interpolated value for a setting.  We could probably check for and trigger the 
hook at that point in time.

2) Much less desirable, hacky... but would work as a last resort: we could put 
a line at the end of "Settings#initialize_app_defaults" that explicitly calls 
the hook for libdir.



-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-bugs?hl=en.

Reply via email to