From 27015e45a3578d448058a1a7e108b956d3882b91 Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Sat, 11 Apr 2020 11:37:11 +0100 Subject: Respond to agent requests with the agent details This makes it possible for an agent to find out what builds it's been allocated, if any. --- guix-build-coordinator/agent-messaging/http.scm | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'guix-build-coordinator/agent-messaging') diff --git a/guix-build-coordinator/agent-messaging/http.scm b/guix-build-coordinator/agent-messaging/http.scm index 2401d41..8160f04 100644 --- a/guix-build-coordinator/agent-messaging/http.scm +++ b/guix-build-coordinator/agent-messaging/http.scm @@ -121,7 +121,10 @@ port. Also, the port used can be changed by passing the --port option.\n" #:code 404)))) (('PUT "agent" uuid) (if (authenticated? uuid request) - (no-content) + (begin + ;; TODO Update status + (render-json + (agent-details datastore uuid))) (render-json "access denied" #:code 403))) @@ -176,13 +179,15 @@ port. Also, the port used can be changed by passing the --port option.\n" coordinator-uri (string-append "/agent/" agent-uuid))) - (http-request - uri - #:method 'PUT ; TODO Should be PATCH - #:body (scm->json-string - `((status . ,status))) - #:headers - `((Authorization . ,auth-value)))) + (let-values (((response body) + (http-request + uri + #:method 'PUT ; TODO Should be PATCH + #:body (scm->json-string + `((status . ,status))) + #:headers + `((Authorization . ,auth-value))))) + (json-string->scm (utf8->string body)))) (define (fetch-builds-for-agent coordinator-uri agent-uuid password) (define auth-value -- cgit v1.2.3