Reputation: 4437
I am trying to add a before_symlink
callback to a custom deploy
Chef recipe, for use on AWS OpsWorks. I’m using the Chef 11 setup, so Amazon’s own receipes take care of 95% of what’s going on.
I’m getting a Recipe Compile Error
:
NoMethodError
-------------
No resource or method named `before_symlink' for `Chef::Recipe "deploy"'
I am still learning Chef so I’m not clear what’s causing this. I’ve called include_recipe 'deploy'
at the beginning of the custom recipe, and Amazon’s own custom deploy recipe seems to work similarly.
Here’s my recipe:
include_recipe 'deploy'
node[:deploy].each do |application, deploy|
if (deploy[:application_type] != 'rails') || (application != 'backscratchers')
Chef::Log.debug("Skipping deploy::rails application #{application} as it is not a Rails app")
next
end
before_symlink do
directory "#{release_path}/tmp" do
mode 0770
end
end
end
Upvotes: 1
Views: 209
Reputation: 54191
The before_symlink
block has to actually go inside deploy
or deploy_revision
recipe. It is unrelated to Amazon's deploy
cookbook/recipe.
That said, I don't not recommend using the deploy
resource anymore as it is overcomplicated for most needs. Check out https://github.com/poise/application_examples/ for examples of a more Chef-style application deployment.
Upvotes: 1