0

我正在使用 Ruby-2.0.0 运行我的 Sinatra 服务器。我正在尝试从 Sinatra 应用程序调用“chef-client”,但出现以下错误:

/usr/local/rvm/gems/ruby-2.0.0-p451@global/gems/bundler-1.6.2/lib/bundler/rubygems_integration.rb:252:in `block in replace_gem': chef is not part of the bundle. Add it to Gemfile. (Gem::LoadError)
from /usr/bin/chef-client:22:in `<main>'

'chef-client' 正在使用“#!/opt/chef/embedded/bin/ruby”。我不想在我的 ruby​​-2.0.0 gemset 中显式安装“chef”gem,在这种情况下有没有办法忽略 Sinatra Ruby 环境设置?

例如

get / do 
  `chef-client`
end

如果我这样做,我会收到这样的错误

/opt/chef/embedded/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs': Could not find chef (>= 0) amongst [bundler-1.6.2, bundler-unload-1.0.2, chef-zero-2.0.2, coderay-1.1.0, diff-lcs-1.2.5, erubis-2.7.0, executable-hooks-1.3.1, gem-wrappers-1.2.4, hashie-2.1.1, highline-1.6.21, ipaddress-0.8.0, method_source-0.8.2, mime-types-1.25.1, mixlib-authentication-1.3.0, mixlib-cli-1.5.0, mixlib-cli-1.3.0, mixlib-config-2.1.0, mixlib-log-1.6.0, mixlib-shellout-1.4.0, net-ssh-2.9.1, net-ssh-gateway-1.2.0, net-ssh-multi-1.2.0, net-ssh-multi-1.1, ohai-7.0.4, pry-0.10.0.pre4, rack-1.5.2, rest-client-1.6.8.rc1, rubygems-bundler-1.4.3, rvm-1.11.3.9, slop-3.5.0, systemu-2.5.2, yajl-ruby-1.2.0] (Gem::LoadError)
from /opt/chef/embedded/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:256:in `to_spec'
from /opt/chef/embedded/lib/ruby/site_ruby/1.9.1/rubygems.rb:1231:in `gem'
from /usr/bin/chef-client:22:in `<main>'

谢谢!

4

0 回答 0