Merge lp:~chad.smith/charm-helpers/resume-pause-idempotent into lp:charm-helpers
Proposed by
Chad Smith
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Stuart Bishop | ||||
Approved revision: | 484 | ||||
Merged at revision: | 482 | ||||
Proposed branch: | lp:~chad.smith/charm-helpers/resume-pause-idempotent | ||||
Merge into: | lp:charm-helpers | ||||
Diff against target: |
284 lines (+176/-68) 3 files modified
VERSION (+1/-1) charmhelpers/core/host.py (+6/-2) tests/core/test_host.py (+169/-65) |
||||
To merge this branch: | bzr merge lp:~chad.smith/charm-helpers/resume-pause-idempotent | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Stuart Bishop (community) | Approve | ||
charmers | Pending | ||
Review via email: mp+277637@code.launchpad.net |
Description of the change
Minor tweak to service_resume and service_pause functions to allow them be idempotent. Supports possibility of successful repeated pause or resume retries if needed.
To post a comment you must log in.
I don't think we need to worry about backwards compatibility here, which is good, since existing charms that would trigger the new behaviour are currently ending up in an error state.
Is service_ running( foo) guaranteed to return true immediately after a start or false immediately after a stop? I don't think sysv makes any such guarantee (not sure about upstart), so I think service_start() will fail with daemons that take a while to startup and write their pid file.
I'd personally trust look-before- you-leap more, only calling stop if service_running() returns true and only calling start if service_running returns false etc. But I don't know what upstart guarantees (nor systemd, when we add xenial support).