我试图将厨师用于以下(Centos VM):
我正在使用https://github.com/fnichol/chef-rvm从包装器食谱中安装rvm。
这是我的食谱中的一部分,它覆盖了rvm食谱,理论上应该是这样做的:
node.override['rvm']['default_ruby'] = 'ruby-1.9.3-p545@chef-test'
node.override[:rvm][:rubies] = [ 'ruby-1.9.3-p545@chef-test' ]
node.override['rvm']['group_users'] = [ 'teamcity' ]
node.override['rvm']['gems'] = {
'ruby-1.9.3-p545@chef-test' => [
{ 'name' => 'rubocop',
'version' => '0.19.1'
},
{ 'name' => 'foodcritic'}
]
}
include_recipe 'rvm::system'
厨师聚合完成没有错误,但当我作为' teamcity'用户并执行其中一个宝石我得到以下内容:
[teamcity@vm02 ~]$ rubocop
/usr/local/rvm/rubies/ruby-1.9.3-p545/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/
kernel_require.rb:135:in `require': cannot load such file
-- ruby-progressbar (LoadError)
from /usr/local/rvm/rubies/ruby-1.9.3-p545/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:135:in `rescue in require'
from /usr/local/rvm/rubies/ruby-1.9.3-p545/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:144:in `require'
from /usr/local/rvm/gems/ruby-1.9.3-p545@chef-test/gems/rubocop-0.19.1/lib/rubocop/formatter/fuubar_style_formatter.rb:3:in `<top (required)>'
from /usr/local/rvm/rubies/ruby-1.9.3-p545/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/local/rvm/rubies/ruby-1.9.3-p545/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/local/rvm/gems/ruby-1.9.3-p545@chef-test/gems/rubocop-0.19.1/lib/rubocop.rb:224:in `<top (required)>'
from /usr/local/rvm/rubies/ruby-1.9.3-p545/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/local/rvm/rubies/ruby-1.9.3-p545/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/local/rvm/gems/ruby-1.9.3-p545@chef-test/gems/rubocop-0.19.1/bin/rubocop:7:in `<top (required)>'
from /usr/local/rvm/gems/ruby-1.9.3-p545@chef-test/bin/rubocop:23:in `load'
from /usr/local/rvm/gems/ruby-1.9.3-p545@chef-test/bin/rubocop:23:in `<main>'
from /usr/local/rvm/gems/ruby-1.9.3-p545@chef-test/bin/ruby_executable_hooks:15:in `eval'
from /usr/local/rvm/gems/ruby-1.9.3-p545@chef-test/bin/ruby_executable_hooks:15:in `<main>'
-- ruby-progressbar (LoadError)
我在这里缺少什么?用户已正确添加到rvm组,并且当我以用户身份登录时,默认情况下会加载正确的gemset。
答案 0 :(得分:1)
这与rubocop依赖于ruby-progressbar有关。见https://github.com/jfelchner/ruby-progressbar/issues/73。可能的解决方法是更新gemfile以使其版本低于&lt; 1.5.0。
更新:现在已在ruby-progressbar 1.5.1中修复此问题。