bundler v1.10.6 で Vagrant マシンへのテストが落ちる
とある puppet リポジトリで vagrant マシンに向けて Serverspec のテストを実行したところ、すべてがFになった。
どうやら vagrant のプラグインがコンフリクトしていて、bundler のバージョンもサポート外の様子。
$ bundle exec rake spec Vagrant experienced a version conflict with some installed plugins! This usually happens if you recently upgraded Vagrant. As part of the upgrade process, some existing plugins are no longer compatible with this version of Vagrant. The recommended way to fix this is to remove your existing plugins and reinstall them one-by-one. To remove all plugins: rm -r ~/.vagrant.d/plugins.json ~/.vagrant.d/gems Note if you have an alternate VAGRANT_HOME environmental variable set, the folders above will be in that directory rather than your user's home directory. The error message is shown below: Bundler could not find compatible versions for gem "bundler": In Gemfile: vagrant (= 1.7.4) ruby depends on bundler (<= 1.10.5, >= 1.5.2) ruby Current Bundler version: bundler (1.10.6) ## テストが落ちる ... ... Finished in 0.21528 seconds (files took 1.25 seconds to load) 21 examples, 21 failures Failed examples: rspec ./spec/web/httpd_spec.rb:4 # Package "httpd" should be installed ... ...
説明に従って、まずプラグインを再インストールしてみる。
$ rm -r ~/.vagrant.d/plugins.json ~/.vagrant.d/gems $ vagrant plugin install <色々>
が、再度テストを実行しても依然として森博嗣だったので、bundler のバージョンを変えて実行してみる。
複数のバージョンの gem がインストールされている場合、デフォルトでは新しい方が使われ、古いバージョンはコマンド実行時に実行したいバージョンを指定する必要があるようだ。
バージョンの指定は command _<version>_
のようにアンダーバーで囲って行う。
$ gem install bundler -v 1.10.5 $ bundle _1.10.5_ exec rake spec
これで実行したところ正常に実行できた。
bundler の v1.10.6 への対応は次回のリリースで行うそうだ。
- Bundler 1.10.6 · Issue #6072 · mitchellh/vagrant