unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: 56075@debbugs.gnu.org
Cc: "Ludovic Courtès" <ludo@gnu.org>
Subject: [bug#56075] [PATCH 2/2] services: configuration: Remove 'validate-configuration'.
Date: Sat, 18 Jun 2022 23:38:32 +0200	[thread overview]
Message-ID: <20220618213832.25165-2-ludo@gnu.org> (raw)
In-Reply-To: <20220618213832.25165-1-ludo@gnu.org>

Now that configuration records use the 'sanitize' property for each
field, 'validate-configuration' has become useless because it's
impossible to construct an invalid configuration record.

* gnu/services/configuration.scm (validate-configuration): Remove.
* gnu/services/mail.scm (dovecot-service): Remove call.
* gnu/services/vpn.scm (openvpn-client-service)
(openvpn-server-service): Likewise.
* doc/guix.texi (Complex Configurations): Remove documentation.
---
 doc/guix.texi                  | 6 ------
 gnu/services/configuration.scm | 9 ---------
 gnu/services/mail.scm          | 4 ----
 gnu/services/vpn.scm           | 2 --
 4 files changed, 21 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 86348fc02c..45f2620476 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -38886,12 +38886,6 @@ Return a G-expression that contains the values corresponding to the
 disk by using something like @code{mixed-text-file}.
 @end deffn
 
-@deffn {Scheme Procedure} validate-configuration @var{configuration}
-@var{fields}
-Type-check @var{fields}, a list of field names of @var{configuration}, a
-configuration record created by @code{define-configuration}.
-@end deffn
-
 @deffn {Scheme Procedure} empty-serializer @var{field-name} @var{value}
 A serializer that just returns an empty string.  The
 @code{serialize-package} procedure is an alias for this.
diff --git a/gnu/services/configuration.scm b/gnu/services/configuration.scm
index c39ea5a02a..e3c101d042 100644
--- a/gnu/services/configuration.scm
+++ b/gnu/services/configuration.scm
@@ -57,7 +57,6 @@ (define-module (gnu services configuration)
             serialize-configuration
             define-maybe
             define-maybe/no-serialization
-            validate-configuration
             generate-documentation
             configuration->documentation
             empty-serializer
@@ -125,14 +124,6 @@ (define (serialize-configuration config fields)
                 ((configuration-field-getter field) config)))
              fields)))
 
-(define (validate-configuration config fields)
-  (for-each (lambda (field)
-              (let ((val ((configuration-field-getter field) config)))
-                (unless ((configuration-field-predicate field) val)
-                  (configuration-field-error
-                   (configuration-field-name field) val))))
-            fields))
-
 (define-syntax-rule (id ctx parts ...)
   "Assemble PARTS into a raw (unhygienic) identifier."
   (datum->syntax ctx (symbol-append (syntax->datum parts) ...)))
diff --git a/gnu/services/mail.scm b/gnu/services/mail.scm
index c2fd4d8670..10e6523861 100644
--- a/gnu/services/mail.scm
+++ b/gnu/services/mail.scm
@@ -1610,10 +1610,6 @@ (define* (dovecot-service #:key (config (dovecot-configuration)))
 by @code{dovecot-configuration}.  @var{config} may also be created by
 @code{opaque-dovecot-configuration}, which allows specification of the
 @code{dovecot.conf} as a string."
-  (validate-configuration config
-                          (if (opaque-dovecot-configuration? config)
-                              opaque-dovecot-configuration-fields
-                              dovecot-configuration-fields))
   (service dovecot-service-type config))
 
 ;; A little helper to make it easier to document all those fields.
diff --git a/gnu/services/vpn.scm b/gnu/services/vpn.scm
index 8be632d55f..ec9ef6b6f0 100644
--- a/gnu/services/vpn.scm
+++ b/gnu/services/vpn.scm
@@ -540,11 +540,9 @@ (define openvpn-client-service-type
 to an existing @acronym{VPN, virtual private network}.")))
 
 (define* (openvpn-client-service #:key (config (openvpn-client-configuration)))
-  (validate-configuration config openvpn-client-configuration-fields)
   (service openvpn-client-service-type config))
 
 (define* (openvpn-server-service #:key (config (openvpn-server-configuration)))
-  (validate-configuration config openvpn-server-configuration-fields)
   (service openvpn-server-service-type config))
 
 (define (generate-openvpn-server-documentation)
-- 
2.36.1





  reply	other threads:[~2022-06-18 21:39 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-18 21:36 [bug#56075] [PATCH 0/2] Report location of invalid configuration field values Ludovic Courtès
2022-06-18 21:38 ` [bug#56075] [PATCH 1/2] services: configuration: Report the location of field type errors Ludovic Courtès
2022-06-18 21:38   ` Ludovic Courtès [this message]
2022-06-23 18:30     ` [bug#56075] [PATCH 2/2] services: configuration: Remove 'validate-configuration' Maxim Cournoyer
2022-06-23 16:05   ` [bug#56075] [PATCH 1/2] services: configuration: Report the location of field type errors Maxim Cournoyer
2022-06-24 21:43     ` bug#56075: [PATCH 0/2] Report location of invalid configuration field values Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220618213832.25165-2-ludo@gnu.org \
    --to=ludo@gnu.org \
    --cc=56075@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).