[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[shepherd] 05/07: service: Remove now irrelevant 'conflicts-with' method
From: |
Ludovic Courtès |
Subject: |
[shepherd] 05/07: service: Remove now irrelevant 'conflicts-with' methods. |
Date: |
Fri, 24 Mar 2023 13:31:41 -0400 (EDT) |
civodul pushed a commit to branch master
in repository shepherd.
commit 7e206fbad57578f67d34ff1804880ae099f10b01
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Fri Mar 24 14:32:57 2023 +0100
service: Remove now irrelevant 'conflicts-with' methods.
This is a followup to fc6e37c5ec46ea68437a2baf42d427a4125058c1: since
there cannot be different services with the same name, there cannot be
conflicts and these two methods are irrelevant. This has been the case
since the introduction of replacements in
9ec5c0000e9a45441417a6ee4138cdcbf1b1f2b2.
* modules/shepherd/service.scm (conflicts-with, conflicts-with-running):
Remove.
(service->sexp): Always return the empty list for 'conflicts'.
(start): Remove conflicts case.
* modules/shepherd/scripts/herd.scm (display-service-status): Remove
conflicts.
* doc/shepherd.texi (Methods of services): Adjust accordingly.
---
doc/shepherd.texi | 5 -----
modules/shepherd/scripts/herd.scm | 3 +--
modules/shepherd/service.scm | 32 +++-----------------------------
tests/respawn-throttling.sh | 1 +
4 files changed, 5 insertions(+), 36 deletions(-)
diff --git a/doc/shepherd.texi b/doc/shepherd.texi
index 477a0b1..0277688 100644
--- a/doc/shepherd.texi
+++ b/doc/shepherd.texi
@@ -760,11 +760,6 @@ with the specified @var{args}, which have a meaning
depending on the
particular action.
@end deffn
-@deffn {method} conflicts-with (obj <service>)
-Returns a list of the canonical names of services that conflict with
-the service @var{obj}.
-@end deffn
-
@deffn {method} canonical-name (obj <service>)
Returns the canonical name of @var{obj}, which is the first element of
the @code{provides} list.
diff --git a/modules/shepherd/scripts/herd.scm
b/modules/shepherd/scripts/herd.scm
index 9f401ef..b7d5b97 100644
--- a/modules/shepherd/scripts/herd.scm
+++ b/modules/shepherd/scripts/herd.scm
@@ -92,7 +92,7 @@ of pairs."
(match service
(('service ('version 0 _ ...) properties ...)
(alist-let* properties (provides requires status running respawn? enabled?
- conflicts last-respawns one-shot? transient?)
+ last-respawns one-shot? transient?)
(format #t (l10n "Status of ~a:~%") (first provides))
;; Note: Shepherd up to 0.9.x included did not provide 'status', hence
@@ -123,7 +123,6 @@ of pairs."
(format #t (l10n " It is disabled.~%")))
(format #t (l10n " Provides ~a.~%") provides)
(format #t (l10n " Requires ~a.~%") requires)
- (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 8d4ccc0..aaa7c85 100644
--- a/modules/shepherd/service.scm
+++ b/modules/shepherd/service.scm
@@ -69,8 +69,7 @@
stop
action
doc
- conflicts-with
- conflicts-with-running
+
launch-service
first-running
lookup-running
@@ -694,16 +693,8 @@ while starting ~a: ~s")
(local-output (l10n "Service ~a is currently disabled.")
(canonical-name obj))
(service-running-value obj))
- ((let ((conflicts (conflicts-with-running obj)))
- (or (null? conflicts)
- (local-output (l10n "Service ~a conflicts with running services
~a.")
- (canonical-name obj)
- (map canonical-name conflicts)))
- (not (null? conflicts)))
- (service-running-value obj))
(else
- ;; It is not running and does not conflict with anything
- ;; that's running, so we can go on and launch it.
+ ;; It is not running; go ahead and launch it.
(let ((problems
;; Resolve all dependencies.
(start-in-parallel (required-by obj))))
@@ -919,23 +910,6 @@ is not already running, and will return SERVICE's
canonical name in a list."
;; FIXME: Implement doc-help.
(local-output (l10n "Unknown keyword. Try 'doc root help'."))))))
-;; Return a list of services that conflict with OBJ.
-(define-method (conflicts-with (obj <service>))
- (delete-duplicates
- (append-map (lambda (sym)
- (filter-map (lambda (service)
- (and (not (eq? service obj))
- service))
- (lookup-services sym)))
- (provided-by obj))
- eq?))
-
-;; Check if this service provides a symbol that is already provided
-;; by any other running services. If so, return these services.
-;; Otherwise, return the empty list.
-(define-method (conflicts-with-running (obj <service>))
- (filter running? (conflicts-with obj)))
-
(define (service->sexp service)
"Return a representation of SERVICE as an sexp meant to be consumed by
clients."
@@ -950,7 +924,7 @@ clients."
;; like #<undefined> to be sent to the client.
(enabled? ,(service-enabled? service))
(running ,(result->sexp (service-running-value service)))
- (conflicts ,(map canonical-name (conflicts-with service)))
+ (conflicts ()) ;deprecated
(last-respawns ,(service-respawn-times service))
(status ,(service-status service))
,@(if (slot-ref service 'one-shot?)
diff --git a/tests/respawn-throttling.sh b/tests/respawn-throttling.sh
index 3a98944..0dd3ec3 100644
--- a/tests/respawn-throttling.sh
+++ b/tests/respawn-throttling.sh
@@ -58,6 +58,7 @@ count=15
while [ $count -gt 0 ]
do
sleep 1
+ $herd status keeps-respawning
if $herd status keeps-respawning | grep disabled
then
# The service is now disabled: success!
- [shepherd] branch master updated (ae51b5f -> e2d324e), Ludovic Courtès, 2023/03/24
- [shepherd] 03/07: service: Move service process monitoring to service controller., Ludovic Courtès, 2023/03/24
- [shepherd] 04/07: service: Removed unnecessary and racy 'handle-termination' messages., Ludovic Courtès, 2023/03/24
- [shepherd] 01/07: service: Remove unused 'make-service-group' macro., Ludovic Courtès, 2023/03/24
- [shepherd] 06/07: service: 'make-systemd-destructor' returns #f once it has closed ports., Ludovic Courtès, 2023/03/24
- [shepherd] 07/07: service: 'stop' no longer prints an extra "has been stopped" message., Ludovic Courtès, 2023/03/24
- [shepherd] 02/07: service: Change protocol for systemd services whose value changes., Ludovic Courtès, 2023/03/24
- [shepherd] 05/07: service: Remove now irrelevant 'conflicts-with' methods.,
Ludovic Courtès <=