Ask Your Question
1

ruby / jruby : cannot see mysql file

asked 2016-10-19 16:37:24 -0500

cm01 gravatar image

updated 2016-12-13 22:15:20 -0500

Hi Guys,

Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Internal Server Error: org.jruby.exceptions.RaiseException: (LoadError) no such file to load -- mysql

but

 rpm -qa|grep -i mysql 
ruby-mysql-2.8.2-1.el6.x86_64

so why do I get his error?
Chris

client puppet 3.3.1; puppet 4.8.0, puppetserver 2.7.0

Updated 14 Dec:
So i had to leave this one for a while and do some other modules, but I'm back

It appears we have 2 modules that use

require "mysql"

in .erb files to enable us to write ruby fns and use them.

puppetserver gem list
says

*** LOCAL GEMS ***

fast_gettext (1.1.0)
gettext (3.2.2)
gettext-setup (0.6)
hocon (1.1.3)
jar-dependencies (0.2.6)
jruby-openssl (0.9.16 java)
json (1.8.0 java)
locale (2.1.2)
rake (10.1.0)
rdoc (4.1.2)
semantic_puppet (0.1.3)
text (1.3.1)

I assume I need to install something, but I really need to know exactly what/how and also do it indirectly, as the systems in qn cannot reach the internet.
HTH

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
4

answered 2016-10-20 11:57:47 -0500

cprice404 gravatar image

When compiling catalogs, Puppet Server uses an embedded JRuby instance that has its own isolated gem path. So you'll want to run puppetserver gem list to see which gems are available for use with Puppet Server.

Here are some docs for using gems in Puppet Server:

https://docs.puppet.com/puppetserver/...

Note that for certain gems such as mysql, you may need to install a jruby-specific version, such as jdbc-mysql.

There is also a puppet module available that you can use to manage Puppet Server's gems with puppet itself:

https://github.com/puppetlabs/puppetl...

edit flag offensive delete link more
0

answered 2016-12-14 17:41:36 -0500

binford2k gravatar image

Is it really necessary to use the mysql library in your erb templates? What are you doing that the community puppetlabs/mysql module doesn't already do?

edit flag offensive delete link more

Comments

They contain custom fns to basically gen various text files eg hostgroups list for icinga .... I'm looking at maybe just rewriting them in in perl but the orig requirement was of course to just 'port' them to v4 server.

cm01 gravatar imagecm01 ( 2016-12-14 18:23:35 -0500 )edit

A better approach would be to either write a custom fact or a strict ruby function, and have that gather your information, and realize that information in your template. I try to keep my templates as 'dumb' as possible, and have them only operate on data. If you were going to write tests for your

DarylW gravatar imageDarylW ( 2016-12-15 07:13:43 -0500 )edit

configuration, how would you 'test' your template? If you externalize the 'fact gathering' part out to either a hiera backend, a function, or a facter fact, or even a puppetdb query, you may make your life a lot eaiser.

DarylW gravatar imageDarylW ( 2016-12-15 07:14:41 -0500 )edit

If you are going to puppet 4, consider puppet 4.8 with the lookup functionality and the 'function' type. https://docs.puppet.com/puppet/latest/lookup_quick_module.html

DarylW gravatar imageDarylW ( 2016-12-15 07:15:30 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2016-10-19 16:37:24 -0500

Seen: 190 times

Last updated: Dec 14 '16