Commit 88260036 authored by Xavier Thompson's avatar Xavier Thompson

proxy: Fix forwarded answer of unready request

When forwarding a request to an external master, e.g. frontend request,
the master might first answer with status code 408 to indicate the
requested resource is not ready.

The slap library wraps the answer into a ComputerPartition object, even
when the master sends 408: in that case the object only contains the
parameters of the original request.

Until now, when the external master answered 408, the proxy simply
forwarded the ComputerPartition object returned by the slap library
with code 200, instead of forwarding code 408.

This played against the assumptions of the slap library in the client
on the receiving end, resulting in a crash. This was the case even when
using `requestoptional` recipe in buildout.

Now the proxy detects when the object returned by the slap library is
actually the result of a 408 answer, and aborts with code 408.
parent b25f64d3
...@@ -714,6 +714,11 @@ def forwardRequestToExternalMaster(master_url, request_form): ...@@ -714,6 +714,11 @@ def forwardRequestToExternalMaster(master_url, request_form):
partition._master_url = master_url # type: ignore partition._master_url = master_url # type: ignore
partition._connection_helper = None partition._connection_helper = None
partition._software_release_document = request_form['software_release'] # type: ignore partition._software_release_document = request_form['software_release'] # type: ignore
if partition._request_dict is not None:
# ResourceNotReady
abort(408)
return dumps(partition) return dumps(partition)
def getAllocatedInstance(partition_reference): def getAllocatedInstance(partition_reference):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment