mirror of
https://codeberg.org/guix/guix.git
synced 2025-10-02 02:15:12 +00:00
services: ‘shepherd-service-upgrade’ handles canonical name changes.
Partly fixes <https://issues.guix.gnu.org/76315>. Fixes a bug whereby a service whose canonical name has changed would not be restarted—e.g., if '(syslogd) has a replacement providing '(system-log syslogd). * gnu/services/shepherd.scm (shepherd-service-upgrade)[running?]: Remove. [to-restart]: Change to a subset of LIVE. Look up all the names of each element of TARGET. * guix/scripts/system/reconfigure.scm (upgrade-shepherd-services): TO-RESTART is now a list of <live-service>; adjust accordingly. * tests/services.scm ("shepherd-service-upgrade: one unchanged, one upgraded, one new"): ("shepherd-service-upgrade: service depended on is not unloaded"): ("shepherd-service-upgrade: obsolete services that depend on each other"): ("shepherd-service-upgrade: transient service"): Adjust accordingly. ("shepherd-service-upgrade: service has new canonical name"): New test. Reported-by: Tomas Volf <~@wolfsden.cz> Change-Id: I7cec495b4e824da5fad5518f039607cf92f935d9
This commit is contained in:
parent
c92fbc83d4
commit
749eb1a2dd
3 changed files with 33 additions and 14 deletions
|
@ -517,8 +517,8 @@ symbols provided/required by a service."
|
|||
|
||||
(define (shepherd-service-upgrade live target)
|
||||
"Return two values: the subset of LIVE (a list of <live-service>) that needs
|
||||
to be unloaded, and the subset of TARGET (a list of <shepherd-service>) that
|
||||
need to be restarted to complete their upgrade."
|
||||
to be unloaded, and the subset of LIVE that needs to be restarted to complete
|
||||
their upgrade."
|
||||
(define (essential? service)
|
||||
(memq (first (live-service-provision service))
|
||||
'(root shepherd)))
|
||||
|
@ -531,10 +531,6 @@ need to be restarted to complete their upgrade."
|
|||
(shepherd-service-lookup-procedure live
|
||||
live-service-provision))
|
||||
|
||||
(define (running? service)
|
||||
(and=> (lookup-live (shepherd-service-canonical-name service))
|
||||
live-service-running))
|
||||
|
||||
(define live-service-dependents
|
||||
(shepherd-service-back-edges live
|
||||
#:provision live-service-provision
|
||||
|
@ -546,8 +542,14 @@ need to be restarted to complete their upgrade."
|
|||
(_ #f)))
|
||||
|
||||
(define to-restart
|
||||
;; Restart services that are currently running.
|
||||
(filter running? target))
|
||||
;; Restart services that appear in TARGET and are currently running.
|
||||
(filter-map (lambda (service)
|
||||
(and=> (any lookup-live
|
||||
(shepherd-service-provision service))
|
||||
(lambda (live)
|
||||
(and (live-service-running live)
|
||||
live))))
|
||||
target))
|
||||
|
||||
(define to-unload
|
||||
;; Unload services that are no longer required. Essential services must
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue