[chef] Re: notifications / subscribe: different cookbook


Chronological Thread 
  • From: Bryan McLellan < >
  • To:
  • Subject: [chef] Re: notifications / subscribe: different cookbook
  • Date: Thu, 24 Jan 2013 18:40:04 -0500

On Thu, Jan 24, 2013 at 6:22 PM, Andrey Brindeyev
< >
 wrote:
> service "tomcat7" do
>     service_name "tomcat7"
>     action :start
>     subscribes :create, resources(:template =>
> node['pam_limits']['config']), :immediately
> end
>
> When I tried to run it, I got expected error:
>
> Cannot find a resource matching template[/etc/security/limits.conf] (did you
> define it first?)

I presume node['pam_limits']['config'] is set to
"/etc/security/limits.conf", do you have a template
"/etc/security/limits.conf" in another recipe that runs before-hand?

You'll want to use the newer notification syntax, because it supports
looking up resources that haven't been created yet in the run.

http://docs.opscode.com/chef/resources.html#notifies-syntax

That said, I've never used a node attribute like that in a
notification, there could be a 'gotcha' there.

Bryan



Archive powered by MHonArc 2.6.16.

§