[chef] Re: Package doesnt notify service?


Chronological Thread 
  • From: Geoff Meakin < >
  • To:
  • Subject: [chef] Re: Package doesnt notify service?
  • Date: Tue, 8 May 2012 03:35:50 +0100

Hi Bryan,

The notification from the package resource will only be sent if the package is being installed or upgraded. So if you already have the latest version of your package then the notification won't be executed.

Thanks for answering my email! This is what currently happens:

[Tue, 08 May 2012 03:31:02 +0100] INFO: Processing package[mongodb] action install (mongodb::10gen_repo line 23)
[Tue, 08 May 2012 03:31:11 +0100] INFO: package[mongodb] installed version 2.0.4
[Tue, 08 May 2012 03:31:11 +0100] INFO: Processing bash[add mongodb superuser] action run (mongodb::10gen_repo line 33)

(add mongodb superuser is my next task, and is wrong as service[mongodb] should have been notified immediately).

I am also a little confused by your logic. In most cookbooks I have seen the service resource will start itself using the ':start' action and the package would if necessary send a ':restart' notification. It seems strange to rely on the package to start the service.

I guess what I was trying to achieve is the following:

1. On a chef run, dont assume that the database should always be started. There might have been good reasons it was taken down by a sysadmin
2. When first installing mongodb package, the service needs starting so some setup items can take place (create users etc.)

I welcome any comments… or maybe Ive found a bug?

Cheers
Geoff

I would expect the following to start service mongodb as soon as the package is installed… but instead it wilfully ignored the notified directive, while installing the package

Anybody have any ideas?


case node['platform']
when "debian", "ubuntu"

 package "mongodb" do
   package_name "mongodb-10gen"
   notifies :start, "service[mongodb]", :immediately
 end

end

service "mongodb" do
 supports :restart => true, :status => true
 action :nothing
end





Archive powered by MHonArc 2.6.16.

§