aboutsummaryrefslogtreecommitdiff
path: root/guix-build-coordinator/agent-messaging
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2020-04-11 11:37:11 +0100
committerChristopher Baines <mail@cbaines.net>2020-04-11 11:37:11 +0100
commit27015e45a3578d448058a1a7e108b956d3882b91 (patch)
tree56ef62f6a41c5efaa05dd730c97c7e2284bf27ac /guix-build-coordinator/agent-messaging
parent970228d8b99669b45c76ecc4df910bfe4f0a48e0 (diff)
downloadbuild-coordinator-27015e45a3578d448058a1a7e108b956d3882b91.tar
build-coordinator-27015e45a3578d448058a1a7e108b956d3882b91.tar.gz
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.
Diffstat (limited to 'guix-build-coordinator/agent-messaging')
-rw-r--r--guix-build-coordinator/agent-messaging/http.scm21
1 files changed, 13 insertions, 8 deletions
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