0

It might just be me doing something horribly wrong, but I seem to be unable to use custom recipes in Chef / AWS OpsWorks deploy hooks:

# before_symlink.rb
include_recipe 'supervisor'

OpsWorks deploy fails with the following error:

NoMethodError
-------------
No resource or method named `include_recipe' for `Chef::Provider::Deploy::Timestamped ""'

We're using Chef 11.10. Any ideas why this might be happening?

Update:

We're using this cookbook. The default recipe installs Supervisord, and so far it's working OK. We run that during the Setup phase.

Trouble comes when attempting to use the supervisor_service resource from the same cookbook during the deploy hook. The error message in this case is:

    No resource or method named `supervisor_service' for 

The first error described above comes when attempting to include the recipe using include_recipe.

0

OpsWorks 'deploy' is a custom AWS addon to Chef and doesn't support the full set of Chef functionality.

Installing supervisord doesn't feel like something that should be deploy-time anyway -- that should be a instance-build-time action, though you might need to perform a service action and deploy-time such that you'd make your cookbook 'depends' on supervisord and have your deploy hook call the necessary resource.

  • Thank you for your answer. In fact, supervisord is being installed at the Setup stage using the default recipe of this cookbook: github.com/poise/supervisor. What we're having trouble with is the configuration during deploy time, as you suggest. The question is: how can I depend on another cookbook from a deploy hook? As I understand it, deploy hooks do not belong to a cookbook, do they? Where is the depends sentence expected to be placed? – cafonso Apr 11 '16 at 19:47
  • It would go in metadata.rb. What happens when you call the supervisor LWRP's during the hook w/o an include_recipe? – Jason Martin Apr 11 '16 at 20:01
  • Without a metadata.rb, calling the supervisor LWRP from the hook produces the error message No resource or method named 'supervisor_service' for [...]. I have updated the question to include more detail as I didn't explain myself properly. I'll try this using a metadata file and see what happens. – cafonso Apr 11 '16 at 20:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.