Puppet

MCollective 無法載入 Stomp 庫?

  • May 12, 2012

CentOS 5.5

重新啟動時我遇到了這個問題mcollective

# service mcollective restart
Shutting down mcollective: 
Starting mcollective: /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require': no such file to load -- stomp (LoadError)
   from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
   from /usr/lib/ruby/site_ruby/1.8/mcollective.rb:2
   from /usr/sbin/mcollectived:3:in `require'
   from /usr/sbin/mcollectived:3
                                                          [FAILED]

STOMP 協議 Ruby 庫已經安裝:

# gem list stomp

*** LOCAL GEMS ***

stomp (1.2.2, 1.1.8)

我正在使用以下 RubyGems 環境執行 ruby​​ 1.8.7:

# ruby -v
ruby 1.8.7 (2008-05-31 patchlevel 0) [x86_64-linux]
# gem env
RubyGems Environment:
 - RUBYGEMS VERSION: 1.3.7
 - RUBY VERSION: 1.8.7 (2008-05-31 patchlevel 0) [x86_64-linux]
 - INSTALLATION DIRECTORY: /usr/local/lib/ruby/gems/1.8
 - RUBY EXECUTABLE: /usr/local/bin/ruby
 - EXECUTABLE DIRECTORY: /usr/local/bin
 - RUBYGEMS PLATFORMS:
   - ruby
   - x86_64-linux
 - GEM PATHS:
    - /usr/local/lib/ruby/gems/1.8
    - /root/.gem/ruby/1.8
 - GEM CONFIGURATION:
    - :update_sources => true
    - :verbose => true
    - :benchmark => false
    - :backtrace => false
    - :bulk_threshold => 1000
 - REMOTE SOURCES:
    - http://rubygems.org/

正如**@RIPienaar**指出的那樣,我混合了 2 個 Ruby 版本:一個是由安裝的yum,另一個是從原始碼編譯的。

我已經解除安裝了所有二進制 ruby​​-* 包,問題應該改為:

如何讓 MCollective 找出從原始碼(到/usr/local/bin)編譯的 Ruby?:

# cd /usr/local/src/marionette-collective
# rake rpm
...
Building RPM for mcollective-2.0.0-1
================
which: no rpmbuild-md5 in (/usr/lib64/qt-3.3/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/usr/local/bin:/opt/redis/bin)
error: Failed build dependencies:
   ruby is needed by mcollective-2.0.0-1.el5.noarch
   ruby(abi) = 1.8 is needed by mcollective-2.0.0-1.el5.noarch
rake aborted!
Failed: rpmbuild -D 'version 2.0.0' -D 'rpm_release 1' -D 'dist .el5' -D 'use_lsb 0' -ba /usr/src/redhat/SPECS/mcollective.spec
/usr/local/src/marionette-collective/Rakefile:35:in `safe_system'
(See full trace by running task with --trace)

或者如何從原始碼編譯 MCollective?

看起來您的系統上有 2 個紅寶石或一些配置錯誤,

mcollective 正在使用 /usr/lib/ruby/* 中的系統 ruby

Starting mcollective: /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require': no such file to load -- stomp (LoadError)

當您的 gem 安裝到 /usr/local/*

 - INSTALLATION DIRECTORY: /usr/local/lib/ruby/gems/1.8

您正在嘗試從需要安裝 ruby​​ 包的 .spec 文件建構 RPM 包。由於您從頭開始編譯 ruby​​,這將是一個問題。

因此,您的解決方案是為 ruby​​ 創建或找到一個規範文件,並根據該規範建構一個 ruby​​ 二進制包。例如,這是我的(我從 1.9.2 分叉):

https://github.com/rilindo/ruby-1.9.3-rpm

建構二進制包後,使用該包重新安裝 ruby​​,刪除/禁用您手動編譯的目前 ruby​​ 安裝,然後從 .spec 文件建構 mcollective 包。

引用自:https://serverfault.com/questions/386646