Puppet Module Gem Dependency

224 views
Skip to first unread message

bryan...@gmail.com

unread,
Dec 25, 2016, 12:38:53 PM12/25/16
to Puppet Users
Cross-posting from Puppet Developers to get a wider audience.

Hello All,

I'm updating a module that will require a ruby gem (e.g. xml-simple) for one of the custom providers. How does Puppet make sure that the gem is available and installed when the module is installed? Does a puppet module install also install any dependent gems? How does it know which gems are needed to install? To where does Puppet install gems?

Or is there something else that consumers of my module will need to do to ensure that the gems are available before they try to use the module's resources?

I tried searching both this group and Puppet Users but didn't find much. May be the key-words aren't right.

I saw/found this PR (https://github.com/puppetlabs/puppet/pull/4220)  which shows a module which requires a gem; but when i try this i still get the error:

Could not autoload puppet/provider/aem_crx_package/ruby: cannot load such file -- xmlsmiple

I've tried the following:

1) Installing the gem with puppetserver gem install and restarting the master
2) Installing it using the gem command in the puppserver bin directory directly (which does not install it to the same place as #1)
3) Specifying package (type gem) on the master like the example in the PR link
4) Specifying package (type gem) on the agent like the example in the PR link

I've also tried to add the confines logic as the PR says, however i still get the missing load file. Here's the project i've been trying to update:


Any help would be appreciated.

-Stopp

Thomas Müller

unread,
Jan 2, 2017, 4:48:34 AM1/2/17
to Puppet Users
HI Bryan




I'm updating a module that will require a ruby gem (e.g. xml-simple) for one of the custom providers. How does Puppet make sure that the gem is available and installed when the module is installed? Does a puppet module install also install any dependent gems? How does it know which gems are needed to install? To where does Puppet install gems?

puppet module install does not install dependent rubygems. Either the module manifests should care about or you should care about.



 

I saw/found this PR (https://github.com/puppetlabs/puppet/pull/4220)  which shows a module which requires a gem; but when i try this i still get the error:

Could not autoload puppet/provider/aem_crx_package/ruby: cannot load such file -- xmlsmiple


this error i've encountered at times when different environments had the same module with different types/providers.

there is official docs about that: https://docs.puppet.com/puppet/latest/environment_isolation.html

With puppet 4.8 you can workaround/solve this problem with running

puppet generate types --environment $name


for every environment.

- Thomas

bryan...@gmail.com

unread,
Jan 2, 2017, 12:51:39 PM1/2/17
to Puppet Users
Thank you, this is the information I was looking for. I was not aware that such was necessary but looks like i'll be adjusting my design accordingly.

Much appreciated.

-Stopp
Reply all
Reply to author
Forward
0 new messages