8

I have a puppet module that uses gini-archive. Recently I change my module to depend on biemond-wildfly, which depends on nanliu-archive.

However, I can't install nanliu-archive, because both of these archive modules install into a directory called archive. This, I believe, violates the puppet module requirements, as they should both install into directories called <username>-archive.

However, even if I put them in different directories, I still have a problem. Both classes are called archive (actually one is a class and one is a define, but I don't think that's too important right now), so when my module says include archive, puppet isn't going to know which one I want.

Note I have a java background where every class is in a package hierarchy which prevents these kind of issues, but I can't see any equivalent for puppet.

I know I could have a whole load of different modules directories (/etc/puppet/modules, /etc/puppet/modules2 etc), but puppet still seems to look through these in order, meaning it will always load the archive class from the first module directory in the list.

Is there any way of solving this or have I reached the limit of what puppet can do? I'd rather not have to fork every single module and change the class names, that seems to defeat the point of the forge.

Thanks.

stripybadger
  • 4,539
  • 3
  • 19
  • 26

2 Answers2

4

The name of the directory the module is in must be archive, the username is only used for the purpose of distributing and packaging modules but is not used by puppet while autoloading. Basically, what you are seeing is correct.

There seems to be two ways of handling this:

  1. Fork one of the two archive modules and rename the module so that it does not collide
  2. Fork one of the modules using the archive modules and migrate it to use the same archive module as the other one. Since the two archive modules do almost the same thing, I prefer this method.
Chris Pitman
  • 12,990
  • 3
  • 41
  • 56
  • 2
    I get the sense that this answer is correct, but it hurts too much to accept it as true. – 7yl4r May 16 '17 at 13:53
3

I just did this so I'm going expand a bit on option (1) in @ChrisPitman's answer by including more details using a module I just forked & renamed as an example.

(Unfortunately) the simplest solution is to fork one of the modules and rename it. Below is an example using puppet/selinux and thias/selinux which have a namespace collision at selinux. The following steps were taken to re-namespace the thias/selinux module into the namespace selinux_thias:

  1. Fork the module. In this example I have created USF-IMaRS/puppet-selinux from thias/puppet-selinux.
  2. Install the module into modules/$NEW_NAME. Using git submodules this is: git submodule add https://github.com/USF-IMARS/puppet-selinux modules/selinux_thias
  3. rename the module class(es). Here is a commit demonstrating what this basically looks like.
  4. modify modules using thias/selinux to use new name selinux_thias instead of selinux.
7yl4r
  • 4,788
  • 4
  • 34
  • 46