Merge lp:~gnuoy/charm-helpers/custom-restart into lp:charm-helpers
| Status: | Merged |
|---|---|
| Merged at revision: | 564 |
| Proposed branch: | lp:~gnuoy/charm-helpers/custom-restart |
| Merge into: | lp:charm-helpers |
| Diff against target: |
131 lines (+52/-8) 3 files modified
charmhelpers/contrib/openstack/utils.py (+4/-2) charmhelpers/core/host.py (+17/-6) tests/core/test_host.py (+31/-0) |
| To merge this branch: | bzr merge lp:~gnuoy/charm-helpers/custom-restart |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| charmers | 2016-04-08 | Pending | |
|
Review via email:
|
|||
Description of the Change
The charms sometimes have to deal with badly behaved init scripts which may incorrectly assert the state of a service. Sometimes a workaround is needed while upstream bugs are filed and fixed.
This change allows a charm to pass in custom function to be used for restarting a specific service. For example the code below will result in pgrep_restart being called when svc1 needs restarting.
def pgrep_restart(
service_
while pgrep(service) != []:
service_
@restart_
| Alex Kavanagh (ajkavanagh) wrote : | # |
| Liam Young (gnuoy) wrote : | # |
Thanks, update to follow
- 565. By Liam Young on 2016-04-08
-
Fix double call to restart function and other fixes from tinwoods review


A corner case is that if called with stopstart=True, then the custom restart_functions will be called twice, once for stop and once for start. I've added a comment below to with some thoughts on how to handle this.