Merge lp:~rvb/maas/bug-1384001-redux into lp:~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: | 3304 |
Proposed branch: | lp:~rvb/maas/bug-1384001-redux |
Merge into: | lp:~maas-committers/maas/trunk |
Diff against target: |
96 lines (+28/-12) 3 files modified
src/maasserver/api/nodes.py (+2/-8) src/maasserver/middleware.py (+10/-2) src/maasserver/tests/test_middleware.py (+16/-2) |
To merge this branch: | bzr merge lp:~rvb/maas/bug-1384001-redux |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Christian Reis (community) | Approve | ||
Julian Edwards (community) | Approve | ||
Graham Binns (community) | Approve | ||
Review via email: mp+239722@code.launchpad.net |
Commit message
Return 503 response for PowerActionAlre
Description of the change
The first change is simply a cleanup: we now use the middleware instead of raising an ad-hoc exception (the test for this already exists).
The second change is a bit more profound: it adds a default Retry-After header for all 503 responses. This will allow API clients such as Juju to retry failed requests.
The related change to gomaasapi is implemented in https:/
To post a comment you must log in.
I appreciate what you're doing but I don't like the direction the code is taking here.
Firstly, IMO mass catch-all middleware is dangerous as developers will be unknowingly shielded from potentially immense cock-ups. Developers need to be aware of all the errors/exceptions coming out of a function all, and deal with them *as soon as possible*. This is a basic tenet of software development.
Secondly, I believe the original middleware fix did not work because the bug that I fixed in the change you're reverting was to stop a *500* error, not a 409 (conflict), which is what should have happened if that middleware was catching the PowerActionAlre adyInProgress correctly.
Thirdly, I don't think a global retry-after value is appropriate, it should be set by each site that raises the error, depending on the situation.
I'm happy to work with you on this if you want to chat about it.