我们在数据中心运行了chef
,最近我们介绍了Mcollective
但是当我尝试使用facts
时,我找不到关于ohai
的任何好文档与mco
我找到了以下插件:
https://github.com/puppetlabs/mcollective-ohai-facts
我根据文档安装并重新启动mcollective服务器守护程序,我收到以下错误:
[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]
我安装了以下gem
:
[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)
我有ruby
1.8和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]
和
[root@server1]# /usr/bin/ruby -v
ruby 1.8.7 (2013-06-27 patchlevel 374) [x86_64-linux]
答案 0 :(得分:1)
Ohai和大多数与Chef相关的代码一般不再与Ruby 1.8兼容。 Ohai 7.x仍然可以在Ruby 1.9.3上运行,但是后期版本需要2.0 +。