[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[shepherd] 11/12: service: Communicate the service status symbol to clie
From: |
Ludovic Courtès |
Subject: |
[shepherd] 11/12: service: Communicate the service status symbol to clients. |
Date: |
Sun, 19 Feb 2023 16:58:37 -0500 (EST) |
civodul pushed a commit to branch wip-service-monitor
in repository shepherd.
commit e52285920ab0c76f6d6a5f0d56c1aea725287181
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Sun Feb 19 22:02:48 2023 +0100
service: Communicate the service status symbol to clients.
* modules/shepherd/service.scm (service->sexp): Add 'status' field.
* tests/status-sexp.sh: Adjust accordingly.
---
modules/shepherd/service.scm | 1 +
tests/status-sexp.sh | 11 +++++++----
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/modules/shepherd/service.scm b/modules/shepherd/service.scm
index 4285197..b94f387 100644
--- a/modules/shepherd/service.scm
+++ b/modules/shepherd/service.scm
@@ -833,6 +833,7 @@ clients."
(running ,(result->sexp (service-running-value service)))
(conflicts ,(map canonical-name (conflicts-with service)))
(last-respawns ,(slot-ref service 'last-respawns))
+ (status ,(service-status service))
,@(if (slot-ref service 'one-shot?)
'((one-shot? #t))
'())
diff --git a/tests/status-sexp.sh b/tests/status-sexp.sh
index 11b967e..5c64c6e 100644
--- a/tests/status-sexp.sh
+++ b/tests/status-sexp.sh
@@ -1,5 +1,5 @@
# GNU Shepherd --- Test status sexps.
-# Copyright © 2016 Ludovic Courtès <ludo@gnu.org>
+# Copyright © 2016, 2023 Ludovic Courtès <ludo@gnu.org>
#
# This file is part of the GNU Shepherd.
#
@@ -71,7 +71,8 @@ root_service_sexp="
(requires ())
(respawn? #f)
(docstring \"The root service is used to operate on shepherd itself.\")
- (enabled? #t) (running #t) (conflicts ()) (last-respawns ()))"
+ (enabled? #t) (running #t) (conflicts ()) (last-respawns ())
+ (status running))"
"$GUILE" -c "
(use-modules (shepherd comm) (srfi srfi-1) (ice-9 match))
@@ -86,12 +87,14 @@ root_service_sexp="
(provides (foo)) (requires ())
(respawn? #t) (docstring \"Foo!\")
(enabled? #t) (running abc) (conflicts ())
- (last-respawns ()))
+ (last-respawns ())
+ (status running))
(service (version 0)
(provides (bar)) (requires (foo))
(respawn? #f) (docstring \"Bar!\")
(enabled? #t) (running #f) (conflicts ())
- (last-respawns ())))))))
+ (last-respawns ())
+ (status stopped)))))))
"
# Make sure we get an 'error' sexp when querying a nonexistent service.
- [shepherd] branch wip-service-monitor created (now da158c5), Ludovic Courtès, 2023/02/19
- [shepherd] 01/12: service: Remove 'stop-delay?' and 'waiting-for-termination?'., Ludovic Courtès, 2023/02/19
- [shepherd] 02/12: service: Handle service state in a monitoring agent., Ludovic Courtès, 2023/02/19
- [shepherd] 06/12: service: 'stop' blocks when a service is already being stopped., Ludovic Courtès, 2023/02/19
- [shepherd] 09/12: service: Rename "service monitor" to "service registry"., Ludovic Courtès, 2023/02/19
- [shepherd] 10/12: service: Clarify expected statuses., Ludovic Courtès, 2023/02/19
- [shepherd] 05/12: service: 'start-in-the-background' starts services in parallel., Ludovic Courtès, 2023/02/19
- [shepherd] 03/12: service: 'start' blocks when a service is already being started., Ludovic Courtès, 2023/02/19
- [shepherd] 04/12: service: Start dependent services in parallel., Ludovic Courtès, 2023/02/19
- [shepherd] 07/12: service: 'service-running-value' uses a fresh channel for each reply., Ludovic Courtès, 2023/02/19
- [shepherd] 11/12: service: Communicate the service status symbol to clients.,
Ludovic Courtès <=
- [shepherd] 12/12: herd: Report 'starting' and 'stopping' service statuses., Ludovic Courtès, 2023/02/19
- [shepherd] 08/12: service: Associate a control fiber with each service., Ludovic Courtès, 2023/02/19