Skip to content

Instantly share code, notes, and snippets.

@gongo
Created February 18, 2015 23:18
Show Gist options
  • Save gongo/231046cab84389a85a71 to your computer and use it in GitHub Desktop.
Save gongo/231046cab84389a85a71 to your computer and use it in GitHub Desktop.
備忘録

続編 of vagrant-itamaeを使っている時にitamaeのpluginがうまく使えなくて困ってる - 半空洞男女関係

workaround でどうにか動いたので備忘録。

まず itamae-plugin を vagrant plugin としてインストールする

$ vagrant plugin install itamae-plugin-recipe-rtn_rbenv

この状態で何かしら vagrant コマンドを実行しようとすると

$ vagrant provision
Vagrant failed to initialize at a very early stage:

The plugins failed to load properly. The error message given is
shown below.

undefined method `include_recipe' for main:Object

こんな感じのエラーが出る。

いろいろあって、下記のように vagrant plugin install された itamae-plugin-recipe-rtn_rbenv を直接編集してみることにする。

$ cd $HOME/.vagrant.d/gems/gems/itamae-plugin-recipe-rtn_rbenv-0.0.6/lib/itamae/plugin/recipe
$ vim rtn_rbenv.rb
 # encoding: utf-8
 
+require 'itamae/receipe'
 include_recipe 'rtn_rbenv::user'

こうしておくと、無事 itamae-plugin-recipe-rtn_rbenv の実行が完了する。

正しい対処かはわからないけど、一応こうすれば、という内容でした。

@mactkg
Copy link

mactkg commented Feb 20, 2015

@gongo

ありがとうございます!! vagrant plugin install...でgemがインストールできるというのは知りませんでした。内部は全部gemでまとまっているんですね。。。

よく考えてみると、userでインストールしたいときはrtn_rbenv::userをincludeするし、systemでインストールしたいときはrtn_rbenv::systemをincludeするはずなので、ここでinclude_recipe 'rtn_rbenv::user'する必要があるのかと思い、削除してみたのですがそれでもうまくいきました。

わざわざ試してくださってありがとうございました。

@gongo
Copy link
Author

gongo commented Feb 21, 2015

@mactkg

よく考えてみると、userでインストールしたいときはrtn_rbenv::userをincludeするし、systemでインストールしたいときはrtn_rbenv::systemをincludeするはずなので、ここでinclude_recipe 'rtn_rbenv::user'する必要があるのかと思い、削除してみたのですがそれでもうまくいきました。

なるほど!追加情報ありがとうございます!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment