From ee08277a70d29b6d707524a4e17620f50b87adf4 Mon Sep 17 00:00:00 2001 From: Attila Lendvai Date: Wed, 24 Aug 2022 14:40:41 +0200 Subject: services: Use the new maybe/unset API. * gnu/home/services/ssh.scm (serialize-address-family): Use the public API of the maybe infrastructure. * gnu/services/file-sharing.scm (serialize-maybe-string): Use maybe-value. (serialize-maybe-file-object): Use maybe-value-set?. * gnu/services/getmail.scm (getmail-retriever-configuration): Don't use internals in unset field declarations. (getmail-destination-configuration): Ditto. * gnu/services/messaging.scm (raw-content?): Use maybe-value-set?. (prosody-configuration): Use %unset-value. * gnu/services/telephony.scm (jami-shepherd-services): Use maybe-value-set?. (archive-name->username): Use maybe-value-set?. * tests/services/configuration.scm ("maybe type, no default"): Use %unset-value. Modified-by: Maxim Cournoyer Signed-off-by: Maxim Cournoyer --- gnu/home/services/ssh.scm | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'gnu/home') diff --git a/gnu/home/services/ssh.scm b/gnu/home/services/ssh.scm index f0987aee23..d15f5ee912 100644 --- a/gnu/home/services/ssh.scm +++ b/gnu/home/services/ssh.scm @@ -69,17 +69,19 @@ (define (serialize-string field value) " " value "\n")) (define (address-family? obj) - (memv obj (list 'unset AF_INET AF_INET6))) + (memv obj (list AF_INET AF_INET6))) + +(define-maybe address-family) (define (serialize-address-family field family) - (if (eq? 'unset family) - "" + (if (maybe-value-set? family) (string-append " " (serialize-field-name field) " " (cond ((= family AF_INET) "inet") ((= family AF_INET6) "inet6") ;; The 'else' branch is unreachable. (else (raise (condition (&error))))) - "\n"))) + "\n") + "")) (define (natural-number? obj) (and (integer? obj) (exact? obj) (> obj 0))) @@ -115,7 +117,7 @@ (define-configuration openssh-host maybe-string "Host name---e.g., @code{\"foo.example.org\"} or @code{\"192.168.1.2\"}.") (address-family - address-family + maybe-address-family "Address family to use when connecting to this host: one of @code{AF_INET} (for IPv4 only), @code{AF_INET6} (for IPv6 only). Additionally, the field can be left unset to allow any address family.") -- cgit v1.2.3