0

We have chef running in our Datacenter and recently we introduce Mcollective but when i am trying to work on facts i didn't find any good documents about ohai integration with mco

I found following Plugin:

https://github.com/puppetlabs/mcollective-ohai-facts

I installed as per documentation and restart mcollective server daemon and i got following error:

    [root@server1 root]# /etc/init.d/mcollective restart
    Shutting down mcollective:
Starting mcollective: /usr/local/rvm/gems/ruby-2.1.3/gems/ohai-7.6.0.rc.0/lib/ohai/loader.rb:188: warning: character class has `[' without escape
/usr/local/rvm/gems/ruby-2.1.3/gems/ohai-7.6.0.rc.0/lib/ohai/loader.rb:188: warning: regexp has `]' without escape
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require': /usr/local/rvm/gems/ruby-2.1.3/gems/mixlib-shellout-2.0.0.rc.0/lib/mixlib/shellout/unix.rb:294: syntax error, unexpected tSYMBEG, expecting tAMPER (SyntaxError)
..._of?(Array) ? exec(*command, :close_others=>true) : exec(com...
                              ^
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
        from /usr/local/rvm/gems/ruby-2.1.3/gems/mixlib-shellout-2.0.0.rc.0/lib/mixlib/shellout.rb:35
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
        from /usr/local/rvm/gems/ruby-2.1.3/gems/ohai-7.6.0.rc.0/lib/ohai/mixin/command.rb:26
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
        from /usr/local/rvm/gems/ruby-2.1.3/gems/ohai-7.6.0.rc.0/lib/ohai/dsl/plugin.rb:22
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
        from /usr/local/rvm/gems/ruby-2.1.3/gems/ohai-7.6.0.rc.0/lib/ohai/dsl.rb:20
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
        from /usr/local/rvm/gems/ruby-2.1.3/gems/ohai-7.6.0.rc.0/lib/ohai/loader.rb:21
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
        from /usr/local/rvm/gems/ruby-2.1.3/gems/ohai-7.6.0.rc.0/lib/ohai/system.rb:19
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
        from /usr/local/rvm/gems/ruby-2.1.3/gems/ohai-7.6.0.rc.0/lib/ohai.rb:21
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:59:in `gem_original_require'
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:59:in `require'
        from /usr/libexec/mcollective/mcollective/facts/opscodeohai_facts.rb:1
        from /usr/lib/ruby/site_ruby/1.8/mcollective/pluginmanager.rb:169:in `load'
        from /usr/lib/ruby/site_ruby/1.8/mcollective/pluginmanager.rb:169:in `loadclass'
        from /usr/lib/ruby/site_ruby/1.8/mcollective/config.rb:156:in `loadconfig'
        from /usr/sbin/mcollectived:45
                                                           [FAILED]

I have following gem installed:

[root@server1 root]# /usr/bin/gem list

*** LOCAL GEMS ***

actionmailer (4.1.6)
actionpack (4.1.6)
actionview (4.1.6)
activemodel (4.1.6)
activerecord (4.1.6)
activesupport (4.1.6)
addressable (2.3.6)
arel (5.0.1.20140414130214)
berkshelf (3.2.1)
berkshelf-api-client (1.2.0)
buff-config (1.0.1)
buff-extensions (1.0.0)
buff-ignore (1.1.1)
buff-ruby_engine (0.1.0)
buff-shell_out (0.2.0)
builder (3.2.2)
bundler (1.7.3)
bundler-unload (1.0.2)
celluloid (0.16.0)
celluloid-io (0.16.1)
chef (12.0.0.alpha.2)
chef-zero (3.1.3)
cleanroom (1.0.0)
coderay (1.1.0)
dep-selector-libgecode (1.0.2)
dep_selector (1.0.3)
diff-lcs (1.2.5)
erubis (2.7.0)
executable-hooks (1.3.2)
faraday (0.9.0)
ffi (1.9.4)
ffi-yajl (1.1.0)
gem-wrappers (1.2.5)
hashie (2.1.2)
highline (1.6.21)
hike (1.2.3)
hitimes (1.2.2)
i18n (0.7.0.beta1)
ipaddress (0.8.0)
knife-vsphere (0.9.9)
libyajl2 (1.0.1)
mail (2.6.1)
method_source (0.8.2)
mime-types (2.3, 1.25.1)
mini_portile (0.6.0)
minitar (0.5.4)
minitest (5.4.1)
mixlib-authentication (1.3.0)
mixlib-cli (1.5.0)
mixlib-config (2.1.0)
mixlib-log (1.6.0)
mixlib-shellout (2.0.0.rc.0)
multi_json (1.10.1)
multipart-post (2.0.0)
net-dhcp (1.2.1)
net-http-persistent (2.9.4)
net-ssh (2.9.1)
net-ssh-gateway (1.2.0)
net-ssh-multi (1.2.0)
netaddr (1.5.0)
nio4r (1.0.1)
nokogiri (1.6.3.1)
octokit (3.5.2)
ohai (7.6.0.rc.0)
plist (3.1.0)
pry (0.10.1)
rack (1.5.2)
rack-test (0.6.2)
rails (4.1.6)
railties (4.1.6)
rbvmomi (1.5.1)
retryable (1.3.6)
ridley (4.1.0)
rubygems-bundler (1.4.4)
rvm (1.11.3.9)
sawyer (0.5.5)
semverse (1.2.1)
slop (3.6.0)
solve (1.2.1)
sprockets (2.12.2)
sprockets-rails (2.1.4)
stomp (1.3.4)
systemu (2.6.4)
thor (0.19.1)
thread_safe (0.3.4)
tilt (1.4.1)
timers (4.0.1)
trollop (2.0)
tzinfo (1.2.2)
uuidtools (2.1.5)
varia_model (0.4.0)
wmi-lite (1.0.0)

Edit

I have both version of ruby 1.8 and 2.1

[root@server1]# /usr/local/rvm/rubies/ruby-2.1.3/bin/ruby -v
ruby 2.1.3p242 (2014-09-19 revision 47630) [x86_64-linux]

and

[root@server1]# /usr/bin/ruby -v
ruby 1.8.7 (2013-06-27 patchlevel 374) [x86_64-linux]
Satish
  • 16,544
  • 29
  • 93
  • 149
  • Are you tied to mcollective? Chef 12 has a push jobs feature that offers similar capabilities. It's also worth noting that Ruby issues, in the chef world, are now largely solved by the omnibus installers which delivery an embedded instance of Ruby. I'm not a fan of rvm on production, but I understand why it's used. – Mark O'Connor Jan 22 '15 at 03:17

1 Answers1

1

Ohai, and most Chef-related code in general, is no longer compatible with Ruby 1.8. Ohai 7.x will still run on Ruby 1.9.3, but late versions require 2.0+.

coderanger
  • 52,400
  • 4
  • 52
  • 75
  • The traceback shows `/usr/lib/ruby/site_ruby/1.8/rubygems/` all over. Methinks your Ruby install is busted. – coderanger Jan 22 '15 at 02:44
  • I have rename `/usr/bin/ruby` and symlink with `ruby-2.1` now i am getting this error `from /usr/local/rvm/rubies/ruby-2.1.3/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'` – Satish Jan 22 '15 at 02:45
  • That isn't how you use RVM. Please fix your Ruby install and try all this again. – coderanger Jan 22 '15 at 03:04
  • as you said i have build new `VM` to test and install `mcollective` using `yum` it install by default `1.8.x` ruby version because dependencies of rpm. Later i installed `2.1.x` ruby using `RVM` and set it default ruby version. Now how i tell mcollective to use ruby `2.1.x` version? Now i am getting this error `Starting mcollective: /usr/local/rvm/gems/ruby-2.1.1/gems/json-1.8.2/lib/json/ext/parser.so: [BUG] Segmentation fault ruby 1.8.7 (2013-06-27 patchlevel 374) [x86_64-linux] ` look like it still looking into `1.8.7` how do i tell mcollective to use new ruby – Satish Jan 22 '15 at 17:14
  • 1
    You have to install mcollective by hand, not via RPM. – coderanger Jan 22 '15 at 17:36
  • Great! finally it works! i installed `mcollective` using tarball. Thanks for your help – Satish Jan 22 '15 at 18:06
  • You can hard code the ruby binary path on below binary `/usr/sbin/mcollectived`. Also if you installed mcollective with ruby1.8.7 then you need to copy the collective files to whatever ruby latest version path. `cp -rp /usr/lib/ruby/site_ruby/1.8/mcollective* /usr/local/rvm/rubies/ruby-2.3.0/lib/ruby/site_ruby/2.3.0/` – Ravi kumar Aug 06 '16 at 04:30
  • Additionally you need to make sure the respective gems should be installed for respective version of ruby. Just check if you current gem path looks for ruby 1.8.7, if so then you need to export GEM_PATH with latest version of ruby gem path whatever you have installed and install the necessary gems. – Ravi kumar Aug 06 '16 at 04:30