Juju should allow "service-destroyed" hooks

Bug #932269 reported by Graham Binns
30
This bug affects 6 people
Affects Status Importance Assigned to Milestone
pyjuju
Triaged
Low
Unassigned

Bug Description

One of the things that we (~yellow) have found whilst building charms is that in certain cases it would be great to be able to specify a service-destroyed hook, which would be responsible for cleaning up a node when a service is torn down.

This can be done at install time for charms that are regularly redeployed to the same set of nodes (e.g. for our buildbot charm, we have an "is buildbot running? stop it" step) but that's an odd place to put it, and anyway we can't rely on only one charm getting deployed to a given node.

For our buildbot charm, hooks/service-destroyed would looks something like this (in psedopython):

{{{
if buildbot_running:
    stop_buildbot()

remove_buildbot_dir()
remove_cached_config_files()
}}}

Revision history for this message
Kapil Thangavelu (hazmat) wrote :

the stop hook should hopefully help this, its not currently being executed, there's a spec out on how to alleviate fix this.

Revision history for this message
Clint Byrum (clint-fewbar) wrote :

Because we're not running stop yet, its poorly defined what it should do. But to me, this is something that would go beyond stop. Stop is "the service should stop all operations". destroyed is "the service is going away permanently, do anything to cleanup external connections/resources/etc".

Changed in juju:
status: New → Triaged
importance: Undecided → Wishlist
Revision history for this message
Richard Harding (rharding) wrote :

Yes, the use case I'm hitting is adding a backup cron script. However, once the service is destroyed, the backup job is still setup in cron attempting to run.

Revision history for this message
Stuart Bishop (stub) wrote :

Similarly, if a unit is removed from a service there is no opportunity to do cleanup. This was causing me grief, as it left a PostgreSQL database in a state that would never start up (configured as a replica, but with the master refusing to talk to it).

Tom Haddon (mthaddon)
tags: added: canonical-webops
Haw Loeung (hloeung)
tags: added: canonical-webops-juju
removed: canonical-webops
Curtis Hovey (sinzui)
Changed in juju:
importance: Wishlist → Low
tags: added: improvement
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.