aws/opsworks-cookbooks — pull request #104 by khouse (2014-02-11 16:14:09+00:00)
Title: Point callback file to shared directory structure for application. Create shared deploy directory

This request is due to the need for before_migrate actions needing to be run prior to the symlink being created for the newly deployed app, but being unable to place the needed before_migrate file into the release path directory before it's symlinked. The issue is that the release path is only created when opsworks_deploy_dir is called, and by that time it makes it difficult to place the before_migrate.rb file in a deploy directory before it completes the deploy. I was also unable to use the release_path variable as it seems to be created during this definition run. I was unable to successfully execute a before_migrate.rb call without this config update. This config change allows for this to work as expected:

#Creates required directory structure to execute Opsworks Deploy
node[:deploy].each do |application, deploy|
opsworks_deploy_dir do
group deploy[:group]
path deploy[:deploy_to]
end
end

template "#{deploy_dir}/shared/deploy/before_migrate.rb" do
source "before_migrate.rb"
end

node[:deploy].each do |application, deploy|
opsworks_deploy do
deploy_data deploy
app application
end
end