複数のバージョンの Ruby を使用しているように見える Rake タスクがあるという奇妙な問題があります。1つ失敗すると、別のものを試すようです。
詳細
- 10.6.5 を実行している MacBook
- rvm1.1.0
- Ruby: 1.8.7-p302、ree-1.8.7-2010.02、ruby-1.9.2-p0
- レーキ 0.8.7
ジェム 1.3.7
Veewee (Opcode.com、Vagrant、Chef を使用した仮想マシンのプロビジョニング)
エラーの具体的な詳細は完全にはわかりませんが、Veewee 自体に問題がある可能性があるためです。だから、私がやろうとしているのは、veewee の定義に基づいて新しいボックスを構築することです。このコマンドは、メソッドが見つからないというエラーで失敗しますが、興味深いのは、どのように失敗するかです。
エラー
RVM で Ruby を 1 つだけインストールすると、失敗することがわかりました。複数の Ruby をインストールしている場合、同じ場所で失敗しますが、実行は別のインタープリターで続行されるようです。
以下は、2 つの異なるクリップされたコンソール出力です。私はサイズのためにそれらを切り取った。各エラーの完全な出力は、 gist として入手できます。
1 つの Ruby バージョンがインストールされている
これは、RVM で利用できる Ruby のバージョンが 1 つしかない (1.8.7) 場合に実行するコマンドです。
boudica:veewee john$ rvm rake build['mettabox'] --trace
rvm 1.1.0 by Wayne E. Seguin (wayneeseguin@gmail.com) [http://rvm.beginrescueend.com/]
(in /Users/john/Work/veewee)
** Invoke build (first_time)
** Execute build
…
creating new harddrive
rake aborted!
undefined method `max_vdi_size' for #<VirtualBox::SystemProperties:0x102d6af80>
/Users/john/.rvm/gems/ruby-1.8.7-p302/gems/virtualbox-0.8.3/lib/virtualbox/abstract_model/dirty.rb:172:in `method_missing'
<------ stacktraces cut ---------->
/Users/john/.rvm/gems/ruby-1.8.7-p302/gems/rake-0.8.7/bin/rake:31
/Users/john/.rvm/gems/ruby-1.8.7-p302@global/bin/rake:19:in `load'
/Users/john/.rvm/gems/ruby-1.8.7-p302@global/bin/rake:19
複数の Ruby バージョン
以下は、RVM で利用可能な 3 つのバージョンの Ruby で同じコマンドを実行したものです。これを行う前は、「rvm use 1.8.7」を使用していました。繰り返しますが、特定のエラーの詳細がどれほど重要かはわかりません。私にとって興味深いのは、3 つの別個のエラーがあり、それぞれに独自のスタック トレースがあり、それぞれが異なる Ruby インタープリターにあるということです。各スタックトレースの下部を見ると、それらはすべて異なるインタープリターの場所から供給されていることがわかります。最初は ree-1.8.7、次に ruby-1.8.7、次に ruby-1.9.2 です。
boudica:veewee john$ rvm rake build['mettabox'] --trace
rvm 1.1.0 by Wayne E. Seguin (wayneeseguin@gmail.com) [http://rvm.beginrescueend.com/]
(in /Users/john/Work/veewee)
** Invoke build (first_time)
** Execute build
…
creating new harddrive
rake aborted!
undefined method `max_vdi_size' for #<VirtualBox::SystemProperties:0x1059dd608>
/Users/john/.rvm/gems/ree-1.8.7-2010.02/gems/virtualbox-0.8.3/lib/virtualbox/abstract_model/dirty.rb:172:in `method_missing'
…
/Users/john/.rvm/gems/ree-1.8.7-2010.02/gems/rake-0.8.7/bin/rake:31
/Users/john/.rvm/gems/ree-1.8.7-2010.02@global/bin/rake:19:in `load'
/Users/john/.rvm/gems/ree-1.8.7-2010.02@global/bin/rake:19
(in /Users/john/Work/veewee)
** Invoke build (first_time)
** Execute build
isofile ubuntu-10.04.1-server-amd64.iso is available
["a1b857f92eecaf9f0a31ecfc39dee906", "30b5c6fdddbfe7b397fe506400be698d"]
[]
Last good state: -1
Current step: 0
last good state -1
destroying machine+disks
(re-)executing step 0-initial-a1b857f92eecaf9f0a31ecfc39dee906
VBoxManage: error: Machine settings file '/Users/john/VirtualBox VMs/mettabox/mettabox.vbox' already exists
VBoxManage: error: Details: code VBOX_E_FILE_ERROR (0x80bb0004), component Machine, interface IMachine, callee nsISupports
Context: "CreateMachine(bstrSettingsFile.raw(), name.raw(), osTypeId.raw(), Guid(id).toUtf16().raw(), FALSE , machine.asOutParam())" at line 247 of file VBoxManageMisc.cpp
rake aborted!
undefined method `memory_size=' for nil:NilClass
/Users/john/Work/veewee/lib/veewee/session.rb:303:in `create_vm'
/Users/john/Work/veewee/lib/veewee/session.rb:166:in `build'
/Users/john/Work/veewee/lib/veewee/session.rb:560:in `transaction'
/Users/john/Work/veewee/lib/veewee/session.rb:163:in `build'
/Users/john/Work/veewee/Rakefile:87
/Users/john/.rvm/gems/ruby-1.8.7-p302/gems/rake-0.8.7/lib/rake.rb:636:in `call'
/Users/john/.rvm/gems/ruby-1.8.7-p302/gems/rake-0.8.7/lib/rake.rb:636:in `execute'
/Users/john/.rvm/gems/ruby-1.8.7-p302/gems/rake-0.8.7/lib/rake.rb:631:in `each'
…
/Users/john/.rvm/gems/ruby-1.8.7-p302/gems/rake-0.8.7/bin/rake:31
/Users/john/.rvm/gems/ruby-1.8.7-p302@global/bin/rake:19:in `load'
/Users/john/.rvm/gems/ruby-1.8.7-p302@global/bin/rake:19
(in /Users/john/Work/veewee)
** Invoke build (first_time)
** Execute build
isofile ubuntu-10.04.1-server-amd64.iso is available
["a9c4ab3257e1da3479c984eae9905c2a", "30b5c6fdddbfe7b397fe506400be698d"]
[]
Last good state: -1
Current step: 0
last good state -1
(re-)executing step 0-initial-a9c4ab3257e1da3479c984eae9905c2a
VBoxManage: error: Machine settings file '/Users/john/VirtualBox VMs/mettabox/mettabox.vbox' already exists
VBoxManage: error: Details: code VBOX_E_FILE_ERROR (0x80bb0004), component Machine, interface IMachine, callee nsISupports
Context: "CreateMachine(bstrSettingsFile.raw(), name.raw(), osTypeId.raw(), Guid(id).toUtf16().raw(), FALSE , machine.asOutParam())" at line 247 of file VBoxManageMisc.cpp
rake aborted!
undefined method `memory_size=' for nil:NilClass
/Users/john/Work/veewee/lib/veewee/session.rb:303:in `create_vm'
/Users/john/Work/veewee/lib/veewee/session.rb:166:in `block in build'
/Users/john/Work/veewee/lib/veewee/session.rb:560:in `transaction'
/Users/john/Work/veewee/lib/veewee/session.rb:163:in `build'
/Users/john/Work/veewee/Rakefile:87:in `block in <top (required)>'
/Users/john/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/rake.rb:634:in `call'
/Users/john/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/rake.rb:634:in `block in execute'
…
/Users/john/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/rake.rb:2013:in `top_level'
/Users/john/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/rake.rb:1992:in `run'
/Users/john/.rvm/rubies/ruby-1.9.2-p0/bin/rake:35:in `<main>'
実行が停止するのは、最後にインストールされた Ruby のバージョンに到達するまでではありません。
討論
ここで何が起こっているのか誰にも分かりませんか?この「フェイルオーバー」のような動作を見たことがありますか? 最初の例外で 1 つのインタープリターのように実行が停止しないのは奇妙に思えますが、RVM をインストールすると、Ruby 開発者が考慮していないことが起こるのではないかと思います。