Issue #13948 has been updated by Jeff Weiss.

Talked with Chris about proposed solution.  Downsides:

1. Iterating over each setting for looking hook
1. Iterating over those with hooks to see if default depends on app_default 
setting.

Discussed a couple options:

1. Calling hook at variable interpolation. Potential problem with `$libdir` => 
mostly write-only setting because hook modifies Ruby `$LOAD_PATH`
1. Modify `:call_on_define` to `:call_hook => [:define|:initialize]`, with 
`:false` maybe in this list.  Then have something in initialize app defaults 
explicitly call the hooks on those settings.

We still have the issue that the hooks won't get called when a dependent 
setting changes; i.e. `$libdir` defined as `$vardir/lib`, but changing 
`$vardir` doesn't cause `$libdir` hook to be called.  Opening a separate ticket 
for this issue.

----------------------------------------
Bug #13948: libdir does not always get added to LOAD_PATH
https://projects.puppetlabs.com/issues/13948#change-61234

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