Merge lp:~gnuoy/charm-helpers/custom-restart into lp:charm-helpers
Proposed by
Liam Young
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 | Pending | ||
Review via email: mp+291372@code.launchpad.net |
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_
To post a comment you must log in.
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.