home: services: ssh: Fix compilation warning with 'serialize-match-criteria'.

* gnu/home/services/ssh.scm (serialize-match-criteria): New procedure.
(serialize-openssh-host): Use it.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
This commit is contained in:
Nicolas Graves 2023-07-21 22:08:07 +02:00 committed by Ludovic Courtès
parent 7605c01fcc
commit 613e913836
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5

View file

@ -203,6 +203,9 @@ (define (match-criteria? str)
first)))) first))))
(memq keyword ssh-match-keywords)))) (memq keyword ssh-match-keywords))))
(define (serialize-match-criteria _ value)
(string-append "Match " value "\n"))
(define-maybe match-criteria) (define-maybe match-criteria)
(define-configuration openssh-host (define-configuration openssh-host
@ -214,7 +217,7 @@ (define-configuration openssh-host
(host-name (host-name
maybe-string maybe-string
"Host name---e.g., @code{\"foo.example.org\"} or @code{\"192.168.1.2\"}.") "Host name---e.g., @code{\"foo.example.org\"} or @code{\"192.168.1.2\"}.")
(match-criteria ;TODO implement stricter match-criteria rules (match-criteria
maybe-match-criteria maybe-match-criteria
"When specified, this string denotes the set of hosts to which the entry "When specified, this string denotes the set of hosts to which the entry
applies, superseding the @code{host-name} field. Its first element must be applies, superseding the @code{host-name} field. Its first element must be
@ -288,8 +291,7 @@ (define (openssh-host-name-or-match-field? field)
(G_ "define either 'name' or 'match-criteria', not both"))) (G_ "define either 'name' or 'match-criteria', not both")))
(string-append "Host " (openssh-host-name config) "\n")) (string-append "Host " (openssh-host-name config) "\n"))
(if (maybe-value-set? (openssh-host-match-criteria config)) (if (maybe-value-set? (openssh-host-match-criteria config))
(string-append (serialize-match-criteria #t (openssh-host-match-criteria config))
"Match " (string-join (openssh-host-match-criteria config) " ") "\n")
(raise (raise
(formatted-message (formatted-message
(G_ "define either 'name' or 'match-criteria' once"))))) (G_ "define either 'name' or 'match-criteria' once")))))