1

How do I tell the mcollective server to use a different ruby path, or otherwise control the ruby environment?

I'm running on Centos 6.5, and have installed the ruby193 collection onto the servers and client. I'm trying to use the puppetlabs 'shell' agent (https://github.com/puppetlabs/mcollective-shell-agent), which requires Ruby 1.9.

When I try a simple 'ls' command like so:

mco shell run ls

All I get is:

* [ ================> ] 1/1
The shell application failed to run: undefined method `sort_by!' for #<Array:blahblahblah>

This looks to me like mcollective is defaulting to the system-installed Ruby 1.8, which is at /usr/bin/ruby, and not using the PATH ruby which is somewhere under /opt/rh/ruby193.

When I installed the ruby193 collection it places a whole bunch of files in /opt/rh/ruby193, and requires source a script to set up. I've put the script in /etc/profile.d, but I'm guessing mcollective isn't using that?

Any ideas/answered SF questions to point me at would be very helpful! Or a working 'shell' agent for mcollective, that would also do :). I'm simply trying to run a shell command on a specific (but dynamic) set of boxes!

shearn89
  • 3,403
  • 2
  • 15
  • 39
  • Have you tried `scl enable ruby193 -- /path/to/mco` ? – Felix Frank Jan 08 '15 at 19:09
  • Tried a few variations on that - ended up with `scl enable ruby193 '/usr/bin/mco shell run ls'`, which returns the same error. – shearn89 Jan 09 '15 at 09:19
  • You might also want to update `mco`s shebang line to point to the software collection. – Felix Frank Jan 09 '15 at 09:59
  • I ended up having more problems with gem paths etc - easier solution is to install RVM system-wide (with appropriate security considerations) and let it handle it for you... – shearn89 Jan 13 '15 at 11:09

1 Answers1

0

In the end this was more trouble than it's worth - I've settled for installing RVM as a Multi-user install, and letting that handle all the relevant paths/gemsets for me. I had to do a bit of reinstalling gems to get Puppet to work again, but in the end it was less work than battling with SCL.

shearn89
  • 3,403
  • 2
  • 15
  • 39