guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[shepherd] 02/06: Add the list of conflicting services to the status sex


From: Ludovic Courtès
Subject: [shepherd] 02/06: Add the list of conflicting services to the status sexp.
Date: Wed, 27 Jan 2016 10:24:11 +0000

civodul pushed a commit to branch master
in repository shepherd.

commit 9569d262810a05cc34bf27e01ba8442a2f967e0c
Author: Ludovic Courtès <address@hidden>
Date:   Wed Jan 27 10:09:02 2016 +0100

    Add the list of conflicting services to the status sexp.
    
    * modules/shepherd/service.scm (service->sexp): Add 'conflicts'.
    * modules/herd.scm (display-service-status): Display it.
    * tests/status-sexp.sh: Adjust accordingly.
---
 modules/herd.scm             |    6 +++---
 modules/shepherd/service.scm |    1 +
 tests/status-sexp.sh         |    6 +++---
 3 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/modules/herd.scm b/modules/herd.scm
index 7075ace..5af708a 100644
--- a/modules/herd.scm
+++ b/modules/herd.scm
@@ -65,7 +65,8 @@ of pairs."
   "Display the status of SERVICE, an sexp."
   (match service
     (('service ('version 0 _ ...) properties ...)
-     (alist-let* properties (provides requires running respawn? enabled?)
+     (alist-let* properties (provides requires running respawn? enabled?
+                             conflicts)
        (format #t (l10n "Status of ~a:~%") (first provides))
        (if running
            (begin
@@ -77,8 +78,7 @@ of pairs."
            (format #t (l10n "  It is disabled.~%")))
        (format #t (l10n "  Provides ~a.~%") provides)
        (format #t (l10n "  Requires ~a.~%") requires)
-       ;; FIXME: We don't have that information.
-       ;; (format #t (l10n "  Conflicts with ~a." (conflicts-with obj)))
+       (format #t (l10n "  Conflicts with ~a.~%") conflicts)
        (if respawn?
            (format #t (l10n "  Will be respawned.~%"))
            (format #t (l10n "  Will not be respawned.~%")))))))
diff --git a/modules/shepherd/service.scm b/modules/shepherd/service.scm
index 31f6684..a7a0daa 100644
--- a/modules/shepherd/service.scm
+++ b/modules/shepherd/service.scm
@@ -491,6 +491,7 @@ clients."
             ;; like #<undefined> to be sent to the client.
             (enabled? ,(enabled? service))
             (running ,(result->sexp (slot-ref service 'running)))
+            (conflicts ,(map canonical-name (conflicts-with service)))
             (last-respawns ,(slot-ref service 'last-respawns))))
 
 (define-method (result->sexp (service <service>))
diff --git a/tests/status-sexp.sh b/tests/status-sexp.sh
index 0f1417c..b7c8cb4 100644
--- a/tests/status-sexp.sh
+++ b/tests/status-sexp.sh
@@ -71,7 +71,7 @@ root_service_sexp="
       (requires ())
       (respawn? #f)
       (docstring \"The root service is used to operate on shepherd itself.\")
-      (enabled? #t) (running #t) (last-respawns ()))"
+      (enabled? #t) (running #t) (conflicts ()) (last-respawns ()))"
 
 "$GUILE" -c "
 (use-modules (shepherd comm) (srfi srfi-1) (ice-9 match))
@@ -85,12 +85,12 @@ root_service_sexp="
             (service (version 0)
               (provides (foo)) (requires ())
               (respawn? #t) (docstring \"Foo!\")
-              (enabled? #t) (running 42)
+              (enabled? #t) (running 42) (conflicts ())
               (last-respawns ()))
             (service (version 0)
               (provides (bar)) (requires (foo))
               (respawn? #f) (docstring \"Bar!\")
-              (enabled? #t) (running #f)
+              (enabled? #t) (running #f) (conflicts ())
               (last-respawns ())))))))
 "
 



reply via email to

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