[[chef-dev]] subscribes and notifies syntax and mechanism


Chronological Thread 
  • From: Avishai Ish-Shalom < >
  • To:
  • Subject: [[chef-dev]] subscribes and notifies syntax and mechanism
  • Date: Fri, 05 Aug 2011 14:33:48 +0300
  • Organization: FewBytes Technologies

following up on CHEF-1994, i think the notification mechanism deserves some rethinking. The implementation of the notifies and subscribes syntax required late evaluation/resolution along with queuing and thus major changes.

The notification system has already undergone design changes over the years and i think a redesign is in order, perhaps as a more general messaging/hook system:

template "my.cnf" do
    notifies :reload, "service[mysql]", :on_update
end
 
template "/etc/php5/apache2/php.ini" do
   notifies :restart, "service[php5]", :very_late
end
execute "do some important stuff" do
   notifies :create, "ruby_block[rollback important stuff]", :on_failure
end

The general design i had in mind is of a central message queue class receiving messages from resources and activating pre-registered callbacks on desired delay (immediately, delayed, very_late, last). notifies/subscribes methods will register callbacks in the message queue.

This design pattern will allow complex execution patterns for recipes, which is both and advantage and disadvantage. It will also allow easy extensions of chef-client which various hooks/handlers if we re-implement parts of chef-client to send messages. (why not trigger handlers using the same mechanism? we can have handlers before_chef_run, before_convergence, etc.)

comments anyone?
-- 
Regards,
Avishai

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature




Archive powered by MHonArc 2.6.16.

§