Feature #770
per module lib directory patch
| Status: | Closed | Start date: | ||
|---|---|---|---|---|
| Priority: | Normal | Due date: | ||
| Assignee: | % Done: | 0% |
||
| Category: | - | |||
| Target version: | 0.24.0 | |||
| Affected Puppet version: | 0.25.4 | Branch: | ||
| Keywords: | ||||
| Votes: | 0 |
Description
h1. Module lib patch
I’ve patched puppet to look for a lib directory inside each module, and add the lib directory to the Puppet::Util::Autoload search path.
This facilitates much more flexible virtual defined types within modules.
The code is available in my public git repository:
git clone http://northstarlabs.net/git/puppet
History
Updated by Jeff McCune almost 5 years ago
The changes are relatively simple, You can test with examples/code/modules/sample-module/manifests/init.pp, which references a native function and uses the result in an erb template.
Updated by Luke Kanies almost 5 years ago
I get this when trying to pull from your repo:
luke@laeg(0) $ git pull http://northstarlabs.net/git/puppet error: pick-rref: HEAD not found No such ref HEAD at http://northstarlabs.net/git/puppet
Is there a specific branch I should use or something?
Updated by David Lutterkort almost 5 years ago
Patch looks very nice. Good stuff.
I see that you use Puppet[:modulepath] directly in searchpath in autoload.rb rather than Puppet::Module::modulepath – is that intentional ? That fails to find lib/ directories in modules set through the PUPPETLIB env var.
Updated by Jeff McCune almost 5 years ago
Replying to [comment:3 lutter]:
Patch looks very nice. Good stuff.
I see that you use Puppet[:modulepath] directly in searchpath in autoload.rb rather than Puppet::Module::modulepath – is that intentional ? That fails to find lib/ directories in modules set through the PUPPETLIB env var.
Yes, it’s intentional. If I recall correctly, the issue is that Pupept::Module::modulepath isn’t yet defined at some points when the methods in question in autoload.rb are invoked. For example, before the configuration file is parsed. As a result, I was getting exceptions when using Puppet::Module::modulepath and just used another method executing at approximately the same point in the call stack as a reference for this patch.
Updated by Matt Palmer over 4 years ago
Doesn’t this mean that you need to have a copy of all your modules on every client machine? Why not sync the plugins out of the module directories on the Puppetmaster, as per http://theshed.hezmatt.org/mattshacks/puppet/_patches/load_plugins_from_modules/20070831054902-6856b-0fd1481621def5d0c4d1ae48fb2f1dc357767c1e.patch ?
Updated by Luke Kanies over 4 years ago
This patch was just set up to work for the server. A patch like yours would be recommended for getting the libraries to the clients.
When did you develop this patch? Is it part of some other ticket or something? I haven’t looked closely at it yet, but it looks like the right way to do it, and it’s a problem that needs to be solved.
Updated by Luke Kanies over 4 years ago
- Status changed from 1 to Closed
- 7 set to fixed
It looks like I actually applied this patch a while ago, I just didn’t close the ticket.
And I guess we should start referring to commit hashes when publishing repos.
Updated by David Schmitt over 4 years ago
reopened Matt’s patch as #891