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!

  • Have you tried scl enable ruby193 -- /path/to/mco ? – Felix Frank Jan 8 '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 9 '15 at 9:19
  • You might also want to update mcos shebang line to point to the software collection. – Felix Frank Jan 9 '15 at 9: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
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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.