mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-12-24 05:18:07 -05:00
services: Validate 'provision' field of <shepherd-service>.
Fixes <https://issues.guix.gnu.org/63979>. * gnu/services/shepherd.scm (validate-provision): New procedure. (<shepherd-service>)[provision]: Use it. Co-authored-by: Bruno Victal <mirai@makinata.eu>
This commit is contained in:
parent
d08cb9bf44
commit
6c0e7b2665
1 changed files with 16 additions and 2 deletions
|
@ -27,8 +27,9 @@ (define-module (gnu services shepherd)
|
|||
#:use-module (guix store)
|
||||
#:use-module (guix records)
|
||||
#:use-module (guix packages)
|
||||
#:use-module (guix derivations) ;imported-modules, etc.
|
||||
#:use-module (guix utils)
|
||||
#:use-module ((guix diagnostics)
|
||||
#:select (define-with-syntax-properties formatted-message))
|
||||
#:use-module (gnu services)
|
||||
#:use-module (gnu services herd)
|
||||
#:use-module (gnu packages admin)
|
||||
|
@ -186,12 +187,25 @@ (define %default-modules
|
|||
((guix build utils) #:hide (delete))
|
||||
(guix build syscalls)))
|
||||
|
||||
(define-with-syntax-properties (validate-provision (provision properties))
|
||||
(match provision
|
||||
(((? symbol?) ..1) provision)
|
||||
(_
|
||||
(raise
|
||||
(make-compound-condition
|
||||
(condition
|
||||
(&error-location
|
||||
(location (source-properties->location properties))))
|
||||
(formatted-message
|
||||
(G_ "'provision' must be a non-empty list of symbols")))))))
|
||||
|
||||
(define-record-type* <shepherd-service>
|
||||
shepherd-service make-shepherd-service
|
||||
shepherd-service?
|
||||
(documentation shepherd-service-documentation ;string
|
||||
(default "[No documentation.]"))
|
||||
(provision shepherd-service-provision) ;list of symbols
|
||||
(provision shepherd-service-provision ;list of symbols
|
||||
(sanitize validate-provision))
|
||||
(requirement shepherd-service-requirement ;list of symbols
|
||||
(default '()))
|
||||
(one-shot? shepherd-service-one-shot? ;Boolean
|
||||
|
|
Loading…
Reference in a new issue