guix-commits
[Top][All Lists]
Advanced

[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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]