sources: use high level message dispatcher

Use the new `BaseAPI._message` high level message dispatcher that
is more convenient to use.
This commit is contained in:
Christian Kellner 2020-07-24 20:03:37 +02:00 committed by Tom Gundersen
parent 93c1be4c5f
commit f8514e782c

View file

@ -36,10 +36,9 @@ class SourcesServer(api.BaseAPI):
except ValueError:
return {"error": f"source returned malformed json: {r.stdout}"}
def _dispatch(self, server):
request, _, addr = server.recv()
reply = self._run_source(request["source"], request["checksums"])
server.send(reply, destination=addr)
def _message(self, msg, fds, sock, addr):
reply = self._run_source(msg["source"], msg["checksums"])
sock.send(reply, destination=addr)
def get(source, checksums, api_path="/run/osbuild/api/sources"):