[chef] Re: How to invoke another recipe with notifies

Chronological Thread 
  • From: Lamont Granquist < >
  • To:
  • Cc: jeffty < >
  • Subject: [chef] Re: How to invoke another recipe with notifies
  • Date: Thu, 08 Oct 2015 15:17:58 -0700

You can't notify a recipe, you can only notify resources.  It may be worthwhile to package your recipe up as an LWRP so that the recipe itself is just a call to the LWRP, then notify the LWRP from the other code.

On 10/08/2015 09:59 AM, jeffty wrote:
" type="cite">

Hi All,


I have two recipe check_out_code.rb and deploy.rb and want to sync code from git, and them deploy the code to server if the sync successfully (which means that some code in this git project has been changed).


In check_out_code.rb:


git node['git_project_directory’] do

    repository  git_url

    action :sync

    notifies :run, "how to call the deploy recipe here?", :immediately



And in deploy.rb the updated file in the git project directory will be deployed to server once a synchronization is performed successfully.


Is it possible? If not maybe we need to define a global variable like:


synced = false


And change it to true if git sync succeeded. Then


if synced then

  include_recipe “mytest::deploy”



But this seems not work either in the git resource.


Thanks & Regards


Archive powered by MHonArc 2.6.16.