Puppet: System Administration Automated

Support

Ticket #770 (closed enhancement: fixed)

Opened 1 year ago

Last modified 1 year ago

per module lib directory patch

Reported by: mccune Assigned to: luke
Priority: normal Milestone: misspiggy
Component: library Version: 0.23.1
Severity: normal Keywords: lib module define type patch
Cc: Triage Stage: Accepted
Attached Patches: Code Complexity: Unknown

Description

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

Change History

08/14/07 17:19:51 changed by mccune

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.

08/15/07 07:30:49 changed by luke

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?

(follow-up: ↓ 4 ) 08/22/07 01:44:50 changed by 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.

(in reply to: ↑ 3 ) 08/22/07 14:26:35 changed by mccune

Replying to 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.

09/06/07 19:48:04 changed by michael

  • stage changed from Unreviewed to Accepted.
  • milestone set to misspiggy.

09/06/07 23:35:14 changed by mpalmer

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 ?

09/06/07 23:54:05 changed by luke

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.

09/07/07 22:00:52 changed by luke

  • status changed from new to closed.
  • resolution 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.

11/08/07 21:26:26 changed by DavidS

reopened Matt's patch as #891