この本の通り書いててこの本の通り書いててvendoring cookbookしたらエラーした。
CakePHPで学ぶ継続的インテグレーション 渡辺 一宏,吉羽 龍太郎,岸田 健一郎,穴澤 康裕,丸山 弘詩 |
エラー
デプロイツール?のCapistrano3っていうのを開発用仮想マシンに入れるところ。下記コマンドでcookbookのひな形を作って
bundle exec knife cookbook create capistrano -o site-cookbooksできたフォルダのrecipes/default.rbを変更、
Vagrantfileのrun_listに追記して、
Berksfileを修正。
source "http://api.berkshelf.com" cookbook "apt" cookbook "phpenv", path: "./site-cookbooks/phpenv" cookbook "hostsfile" cookbook "capistrano", path: "./site_cookbooks/capistrano"で、cookbooksをvendoringしたらエラーした。
naichilabmba:vagrant_book hu$ bundle exec berks vendor cookbooks Resolving cookbook dependencies... Fetching 'phpenv' from source at site-cookbooks/phpenv Fetching 'capistrano' from source at site_cookbooks/capistrano The resource at '/Users/hu/Documents/vagrant_book/site_cookbooks/capistrano' does not appear to be a valid cookbook. Does it have a metadata.rb?
metadata.rb?
metadata.rbはどう見てもあるんだよなぁ。naichilabmba:vagrant_book hu$ ls site-cookbooks/capistrano/ CHANGELOG.md README.md attributes definitions files libraries metadata.rb providers recipes resources templatesなぜだ…
phpenvの方のvendoringは問題なく成功してるし…。うーむ。
phpenvの方
capistranoの方
phpenvの方は1行追加してあるけど他は全く一緒だよなぁ。
そもそも「knife cookbook create」で作ったテンプレートのままだし。
ためしにphpenvの方のmetadata.rbをリネームしてberks vendorしてみた。
naichilabmba:vagrant_book hu$ bundle exec berks vendor cookbooks /Users/hu/.rbenv/versions/1.9.3-p547/lib/ruby/gems/1.9.1/gems/ridley-4.1.0/lib/ridley/chef/cookbook.rb:40:in `from_path': no metadata.json or metadata.rb found at /Users/hu/Documents/vagrant_book/site-cookbooks/phpenv (IOError) from /Users/hu/.rbenv/versions/1.9.3-p547/lib/ruby/gems/1.9.1/gems/berkshelf-3.1.5/lib/berkshelf/locations/path.rb:21:in `cached_cookbook' from /Users/hu/.rbenv/versions/1.9.3-p547/lib/ruby/gems/1.9.1/gems/berkshelf-3.1.5/lib/berkshelf/dependency.rb:126:in `cached_cookbook' from /Users/hu/.rbenv/versions/1.9.3-p547/lib/ruby/gems/1.9.1/gems/berkshelf-3.1.5/lib/berkshelf/lockfile.rb:387:in `block in reduce!' from /Users/hu/.rbenv/versions/1.9.3-p547/lib/ruby/gems/1.9.1/gems/berkshelf-3.1.5/lib/berkshelf/lockfile.rb:372:in `each' from /Users/hu/.rbenv/versions/1.9.3-p547/lib/ruby/gems/1.9.1/gems/berkshelf-3.1.5/lib/berkshelf/lockfile.rb:372:in `reduce!' from /Users/hu/.rbenv/versions/1.9.3-p547/lib/ruby/gems/1.9.1/gems/berkshelf-3.1.5/lib/berkshelf/installer.rb:32:in `run' from /Users/hu/.rbenv/versions/1.9.3-p547/lib/ruby/gems/1.9.1/gems/berkshelf-3.1.5/lib/berkshelf/berksfile.rb:371:in `install' from /Users/hu/.rbenv/versions/1.9.3-p547/lib/ruby/gems/1.9.1/gems/berkshelf-3.1.5/lib/berkshelf/berksfile.rb:590:in `vendor' from /Users/hu/.rbenv/versions/1.9.3-p547/lib/ruby/gems/1.9.1/gems/berkshelf-3.1.5/lib/berkshelf/cli.rb:387:in `vendor' from /Users/hu/.rbenv/versions/1.9.3-p547/lib/ruby/gems/1.9.1/gems/thor-0.19.1/lib/thor/command.rb:27:in `run' from /Users/hu/.rbenv/versions/1.9.3-p547/lib/ruby/gems/1.9.1/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command' from /Users/hu/.rbenv/versions/1.9.3-p547/lib/ruby/gems/1.9.1/gems/thor-0.19.1/lib/thor.rb:359:in `dispatch' from /Users/hu/.rbenv/versions/1.9.3-p547/lib/ruby/gems/1.9.1/gems/berkshelf-3.1.5/lib/berkshelf/cli.rb:52:in `dispatch' from /Users/hu/.rbenv/versions/1.9.3-p547/lib/ruby/gems/1.9.1/gems/thor-0.19.1/lib/thor/base.rb:440:in `start' from /Users/hu/.rbenv/versions/1.9.3-p547/lib/ruby/gems/1.9.1/gems/berkshelf-3.1.5/lib/berkshelf/cli.rb:27:in `execute!' from /Users/hu/.rbenv/versions/1.9.3-p547/lib/ruby/gems/1.9.1/gems/berkshelf-3.1.5/bin/berks:5:in `<top (required)>' from /Users/hu/.rbenv/versions/1.9.3-p547/bin/berks:23:in `load' from /Users/hu/.rbenv/versions/1.9.3-p547/bin/berks:23:in `<main>' naichilabmba:vagrant_book hu$IOエラーに変わっただと…?
一旦phpenvの方のmetadata.rbを戻してcapistrano側のmetadata.rbをリネームしてみた。
naichilabmba:vagrant_book hu$ bundle exec berks vendor cookbooks Resolving cookbook dependencies... Fetching 'phpenv' from source at site-cookbooks/phpenv Fetching 'capistrano' from source at site_cookbooks/capistrano The resource at '/Users/hu/Documents/vagrant_book/site_cookbooks/capistrano' does not appear to be a valid cookbook. Does it have a metadata.rb? naichilabmba:vagrant_book hu$結果変わらず。 どういう状態だろ。
metadata.rbを読み込みに行く前に無いと判断されてる?
設定ファイルミスったかなぁ。
原因発見
改めてBerksfile眺めてたら見つけた。ひどいミス。
source "http://api.berkshelf.com" cookbook "apt" cookbook "phpenv", path: "./site-cookbooks/phpenv" cookbook "hostsfile" #cookbook "capistrano", path: "./site_cookbooks/capistrano" cookbook "capistrano", path: "./site-cookbooks/capistrano"まぁそんなもんだよね…。
pathが含まれるエラーはとりあえずそのpathの存在見ないとな…すぐ分かったはずなのに。