[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 ())))))))
"
- [shepherd] branch master updated (88c6a20 -> 83567c4), Ludovic Courtès, 2016/01/27
- [shepherd] 06/06: Default system-wide config file is now /etc/shepherd.scm., Ludovic Courtès, 2016/01/27
- [shepherd] 01/06: Canonicalize the running value to valid read syntax., Ludovic Courtès, 2016/01/27
- [shepherd] 03/06: Move commands to (shepherd scripts xyz)., Ludovic Courtès, 2016/01/27
- [shepherd] 04/06: build: Install Guile modules to the usual place., Ludovic Courtès, 2016/01/27
- [shepherd] 02/06: Add the list of conflicting services to the status sexp.,
Ludovic Courtès <=
- [shepherd] 05/06: build: Build man pages., Ludovic Courtès, 2016/01/27