我正在开发一本食谱来部署一个简单的基于jekyll的博客.我使用'application'cookbook作为基础.一切顺利,但厨师只是忽略了我定义的回调.
Chef日志包含有关我的回调的条目,但我看不到回调执行的错误或结果.
这是recipes/default.rb文件:
include_recipe "git"
application "example_com" do
path "/var/www/example.com"
repository "git@example.org:xxx/xxx.git"
revision "master"
deploy_key <<EOF
-----BEGIN RSA PRIVATE KEY-----
..skip...
-----END RSA PRIVATE KEY-----
EOF
# before_symlink "script/bootstrap"
before_deploy do
# raise
# Chef::Log.info("INSANE!")
execute "bundle exec rake generate" do
cwd release_path
end
end
end
Run Code Online (Sandbox Code Playgroud)
以下是chef-client表示执行before_deploy回调的日志:
[2012-10-06T10:06:20-04:00] INFO: Processing ruby_block[example_com before_deploy] action create (/var/cache/chef/cookbooks/application/providers/default.rb line 107)
[2012-10-06T10:06:20-04:00] DEBUG: Got callback before_deploy: #<Proc:0x00007f0509788088@/var/cache/chef/cookbooks/example_com/recipes/default.rb:24>
[2012-10-06T10:06:20-04:00] INFO: application[example_com] running callback before_deploy
[2012-10-06T10:06:20-04:00] INFO: ruby_block[example_com before_deploy] called
[2012-10-06T10:06:20-04:00] INFO: Processing deploy_revision[example_com] action deploy …Run Code Online (Sandbox Code Playgroud) chef-infra ×1