Merge lp://staging/~rvb/maas/dhcp-stop-bug-1328656 into lp://staging/~maas-committers/maas/trunk
Proposed by
Raphaël Badin
Status: | Merged |
---|---|
Approved by: | Raphaël Badin |
Approved revision: | no longer in the source branch. |
Merged at revision: | 2423 |
Proposed branch: | lp://staging/~rvb/maas/dhcp-stop-bug-1328656 |
Merge into: | lp://staging/~maas-committers/maas/trunk |
Diff against target: |
105 lines (+58/-2) 2 files modified
src/provisioningserver/tasks.py (+26/-1) src/provisioningserver/tests/test_tasks.py (+32/-1) |
To merge this branch: | bzr merge lp://staging/~rvb/maas/dhcp-stop-bug-1328656 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Jeroen T. Vermeulen (community) | Approve | ||
Review via email: mp+223049@code.staging.launchpad.net |
Commit message
Ignore the 'server already stopped' error when stopping MAAS' DHCP server.
Description of the change
We could have maintained the state of the DHCP server in MAAS and change MAAS to only call 'stop' on the service when it's actually needed but making the call to tasks.stop_
Also, checking both the return code and the error message means the new code path is a bit fragile (although the error message comes from deep inside upstart's code and I expect the error to remain unchanged) but at least MAAS won't be hiding legitimate errors.
To post a comment you must log in.
Don't feel guilty for not tracking the state of the DHCP server: with these things you sort of have to assume that you'll get it wrong anyway, what with restarts and failures and race conditions. The only truth is reality itself — whether the service is actually running.
I do think the check for the error message is still a bit brittle. For starters, make sure the upstart command runs in the “C” locale so we don't get a translated version of the message. Also I'd at least normalise whitespace: ' '.join( output. strip() .split( )). It may even be worth a dedicated test.
You may also want to say that (apparently) the error ends in a colon, with nothing to follow. It looks weird, and reading it I sort of expected a "message begins with" check.
The comments about the upstart error (lines 16—17 and 33—34 of the diff) strike me as being the wrong way around. From the reader's perspective, the fact that Upstart issues this error is the first thing. After that it may or may not be worth saying that we use these variables to recognise that situation, or that we ignore it, respectively.