[chef] Re: pre-update notifications


Chronological Thread 
  • From: Daniel DeLeo < >
  • To:
  • Subject: [chef] Re: pre-update notifications
  • Date: Thu, 22 Aug 2013 08:06:19 -0700


On Thursday, August 22, 2013 at 5:31 AM, Gregoire Seux wrote:

Hello,

I'd like to have pre-update notifications which would be the same as
"notifies" but triggered before resource convergence.

For instance, some packages automatically restart a service during
upgrade and I'd like to downtime the host in supervision _before_
actually starting to upgrade those packages.

Classic notifications would be :

package "cassandra" do
notifies :run, "execute[downtime host]"
end

but notification is triggered _after_ the upgrade so it is not useful
anymore.

I wondered how to do this and came up with a partial solution switching
to why_run temporarily to find wether a given resource (package) will
be updated during convergence.
which would execute the resource to downtime only if the package will be
upgrade later.

Does anyone has already encountered such need? and fixed it?

--
Grégoire
Your problem here is that Chef resources are declarative, i.e., they say what the state of the system should be, but in this case you're trying to control the way the system transitions from one state (old packages) to another (up-to-date packages). The best way to accomplish this is to write a LWRP that checks if a new package is available and shuts the service down before upgrading.


-- 
Daniel DeLeo




Archive powered by MHonArc 2.6.16.

§