How can I deal with puppet modules with classes of the same name?

I have a puppet module that uses gini-archive . Recently, I am changing my module to a dependency on biemond-wildfly , which is dependent on nanliu -archive .

However, I cannot install nanliu-archive because both of these archive modules are installed in a directory called archive . This, I believe, violates the requirements of the puppet module, as they must be installed in 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 of them is a class and one is a definition, but I don’t think it is too important now), so when my module says include archive , the puppet will not know which one I want .

Note. I have a java background where each class is in the package hierarchy, which prevents similar problems, but I do not see the equivalent for the puppet one.

I know that I can have a whole load of various module directories ( /etc/puppet/modules , /etc/puppet/modules2 , etc.), but the puppet still seems to be viewing them in order, that is, it always will load the archive class from the first module directory in the list.

Is there a way to solve this or have I reached the limit of what a puppet can do? I would prefer not to fork each module and change the names of the classes that seem to defeat the forge point.

Thanks.

+5
source share
2 answers

The name of the directory in which the module is located must be archive , the username is used only for distribution and packaging of modules, but is not used by the puppet during startup. Basically, what you see is right.

There seem to be two ways to handle this:

  • Insert one of the two archive modules and rename the module so that it does not collide.
  • Create one of the modules using archive modules and transfer it to use the same archive module as the other. Since the two archive modules do almost the same thing, I prefer this method.
+2
source

I just did this to expand option (1) a bit in @ChrisPitman's answer by including more details using a module that I just forked and renamed as an example.

(Unfortunately) the simplest solution is to branch one of the modules and rename it. The following is an example of using puppet/selinux and thias/selinux , which have a namespace collision in selinux . The following steps have been taken to rename the thias/selinux module space to the thias/selinux namespace:

  • Insert the module. In this example, I created USF-IMaRS / puppet-selinux from thias / puppet-selinux .
  • Install the module in modules/$NEW_NAME . Using git submodules, this is: git submodule add https://github.com/USF-IMARS/puppet-selinux modules/selinux_thias
  • rename the module class. Here is a commit, demonstrating how it looks basically.
  • modify the modules using thias / selinux to use the new name selinux_thias instead of selinux .
0
source

All Articles