我正在嘗試一個流浪漢安裝,並希望1.9.3-p327
作爲默認的ruby版本。我正在使用廚師獨奏和圖書管理員廚師來管理流浪機。對於廚師獨奏在vagrant rbenv上安裝ruby 1.9.3 NoMethodError loaded_recipe?
我流浪漢文件配置看起來像這樣
config.vm.provision :chef_solo do |chef|
chef.cookbooks_path = "cookbooks"
chef.add_recipe "apt"
chef.add_recipe "build-essential"
chef.add_recipe "git"
chef.add_recipe "ruby_build"
chef.add_recipe "rbenv::system"
chef.add_recipe "rbenv::vagrant"
chef.add_recipe "sqlite"
chef.add_recipe "nodejs"
chef.add_recipe "mysql"
chef.add_recipe "redisio"
chef.add_recipe "redisio::install"
chef.add_recipe "redisio::redis_gem"
chef.add_recipe "zlib"
chef.add_recipe "wkhtmltopdf"
chef.json = {
"rbenv" => {
"rubies" => [ "1.9.3-p327" ],
"global" => "1.9.3-p327",
"gems" => {
"1.9.3-p327" => [
{ "name" => "bundler" }
]
}
}
}
end
和館員cheff查找這個樣子的
site 'http://community.opscode.com/api/v1'
cookbook 'apt'
cookbook 'git'
cookbook 'build-essential'
cookbook 'rbenv',
git: 'https://github.com/fnichol/chef-rbenv.git'
cookbook 'ruby_build'
cookbook 'sqlite',
git: 'git://github.com/opscode-cookbooks/sqlite.git'
cookbook 'nodejs',
git: 'http://github.com/mdxp/nodejs-cookbook'
cookbook 'mysql',
git: 'git://github.com/opscode-cookbooks/mysql.git'
cookbook 'redisio',
git: 'git://github.com/brianbianco/redisio.git'
cookbook 'zlib',
git: 'git://github.com/opscode-cookbooks/zlib'
cookbook 'wkhtmltopdf',
git: 'git://github.com/firstbanco/chef-wkhtmltopdf.git'
,並從這兩個我應該能夠在cheffile不幸的是,它運行vagrant文件,看起來好像我在哪裏指定紅寶石的版本,以廚師獨奏轟炸。它在昨天下午工作,這導致我認爲有人在當時和現在之間更新了食譜。所以,當我打電話館員廚師安裝它把它和已經嚇壞了..
================================================================================
Error executing action `install` on resource 'rbenv_ruby[1.9.3-p327] (system)'
================================================================================
NoMethodError
-------------
undefined method `loaded_recipe?' for #<Chef::RunContext:0x7f34cf773ed0>
Cookbook Trace:
---------------
/tmp/vagrant-chef-1/chef-solo-1/cookbooks/rbenv/providers/ruby.rb:88:in `ruby_build_missing?'
/tmp/vagrant-chef-1/chef-solo-1/cookbooks/rbenv/providers/ruby.rb:43:in `perform_install'
/tmp/vagrant-chef-1/chef-solo-1/cookbooks/rbenv/providers/ruby.rb:33:in `class_from_file'
Resource Declaration:
---------------------
# In /tmp/vagrant-chef-1/chef-solo-1/cookbooks/rbenv/recipes/system.rb
27: else
28: rbenv_ruby rubie
29: end
Compiled Resource:
------------------
# Declared in /tmp/vagrant-chef-1/chef-solo-1/cookbooks/rbenv/recipes/system.rb:28:in `from_file'
rbenv_ruby("1.9.3-p327") do
retry_delay 2
retries 0
recipe_name "system"
definition "1.9.3-p327"
action :install
cookbook_name :rbenv
end
[2013-05-31T09:55:55+00:00] ERROR: Running exception handlers
[2013-05-31T09:55:55+00:00] ERROR: Exception handlers complete
[2013-05-31T09:55:55+00:00] FATAL: Stacktrace dumped to /tmp/vagrant-chef-1/chef-stacktrace.out
[2013-05-31T09:55:55+00:00] FATAL: NoMethodError: rbenv_ruby[1.9.3-p327] (system) (rbenv::system line 28) had an error: NoMethodError: undefined method `loaded_recipe?' for #<Chef::RunContext:0x7f34cf773ed0>
Chef never successfully completed! Any errors should be visible in the
output above. Please fix your recipes so that they properly complete.
如果我註釋掉指定紅寶石版本,那麼它的工作原理JSON。似乎生病不得不指定rbenv的版本,但是什麼是可信的版本,我在哪裏可以找到它們。
編輯:您還必須在json中指定用戶詳細信息。因爲你安裝到系統和用戶(流浪)級別。廚師正在使用流浪盒提供的紅寶石。這裏是我更新的rbenv json ruby版本的樣子。
chef.json = {
'rbenv' => {
'user_installs' => [
{
'user' => 'vagrant',
'rubies' => ['1.9.3-p327'],
'global' => '1.9.3-p327',
'gems' => {
'1.9.3-p327' => [
{ 'name' => 'bundler' },
{ 'name' => 'rake' }
]
}
}
]
},
謝謝!那工作。它真的很奇怪,所有關於流浪漢和設置欄杆的博客都沒有提到這一點。 – TheLegend