unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Bruno Victal <mirai@makinata.eu>
To: 61829@debbugs.gnu.org
Cc: Bruno Victal <mirai@makinata.eu>
Subject: [bug#61829] [PATCH 03/11] services: ntp-service-type: Remove deprecated server as strings support.
Date: Mon, 27 Feb 2023 00:11:36 +0000	[thread overview]
Message-ID: <2046be031f35d2eb4e9ed278c06a2e832d565671.1677456515.git.mirai@makinata.eu> (raw)
In-Reply-To: <cover.1677456515.git.mirai@makinata.eu>

* gnu/services/networking.scm (<ntp-configuration>)[servers]: Rename accessor to ntp-configuration-servers.
(ntp-configuration-servers): Remove helper procedure.
(ntp-shepherd-service): Remove helper procedure usage.
* tests/networking.scm: Remove obsolete test.
---
 gnu/services/networking.scm | 57 +++++++++++++------------------------
 tests/networking.scm        | 11 -------
 2 files changed, 20 insertions(+), 48 deletions(-)

diff --git a/gnu/services/networking.scm b/gnu/services/networking.scm
index dacf64c2d1..ef66393937 100644
--- a/gnu/services/networking.scm
+++ b/gnu/services/networking.scm
@@ -481,36 +481,19 @@ (define-record-type* <ntp-configuration>
   ntp-configuration?
   (ntp      ntp-configuration-ntp
             (default ntp))
-  (servers  %ntp-configuration-servers   ;list of <ntp-server> objects
+  (servers  ntp-configuration-servers     ;list of <ntp-server> objects
             (default %ntp-servers))
   (allow-large-adjustment? ntp-allow-large-adjustment?
                            (default #t))) ;as recommended in the ntpd manual
 
-(define (ntp-configuration-servers ntp-configuration)
-  ;; A wrapper to support the deprecated form of this field.
-  (let ((ntp-servers (%ntp-configuration-servers ntp-configuration)))
-    (match ntp-servers
-      (((? string?) (? string?) ...)
-       (format (current-error-port) "warning: Defining NTP servers as strings is \
-deprecated.  Please use <ntp-server> records instead.\n")
-       (map (lambda (addr)
-              (ntp-server
-               (type 'server)
-               (address addr)
-               (options '()))) ntp-servers))
-      ((($ <ntp-server>) ($ <ntp-server>) ...)
-       ntp-servers))))
-
 (define (ntp-shepherd-service config)
   (match-record config <ntp-configuration>
     (ntp servers allow-large-adjustment?)
-    (let ((servers (ntp-configuration-servers config)))
-      ;; TODO: Add authentication support.
-      (define config
-        (string-append "driftfile /var/run/ntpd/ntp.drift\n"
-                       (string-join (map ntp-server->string servers)
-                                    "\n")
-                       "
+    ;; TODO: Add authentication support.
+    (define config
+      (string-append "driftfile /var/run/ntpd/ntp.drift\n"
+                     (string-join (map ntp-server->string servers) "\n")
+                     "
 # Disable status queries as a workaround for CVE-2013-5211:
 # <http://support.ntp.org/bin/view/Main/SecurityNotice#DRDoS_Amplification_Attack_using>.
 restrict default kod nomodify notrap nopeer noquery limited
@@ -524,21 +507,21 @@ (define (ntp-shepherd-service config)
 # option by default, as documented in the 'ntp.conf' manual.
 restrict source notrap nomodify noquery\n"))
 
-      (define ntpd.conf
-        (plain-file "ntpd.conf" config))
+    (define ntpd.conf
+      (plain-file "ntpd.conf" config))
 
-      (list (shepherd-service
-             (provision '(ntpd))
-             (documentation "Run the Network Time Protocol (NTP) daemon.")
-             (requirement '(user-processes networking))
-             (start #~(make-forkexec-constructor
-                       (list (string-append #$ntp "/bin/ntpd") "-n"
-                             "-c" #$ntpd.conf "-u" "ntpd"
-                             #$@(if allow-large-adjustment?
-                                    '("-g")
-                                    '()))
-                       #:log-file "/var/log/ntpd.log"))
-             (stop #~(make-kill-destructor)))))))
+    (list (shepherd-service
+           (provision '(ntpd))
+           (documentation "Run the Network Time Protocol (NTP) daemon.")
+           (requirement '(user-processes networking))
+           (start #~(make-forkexec-constructor
+                     (list (string-append #$ntp "/bin/ntpd") "-n"
+                           "-c" #$ntpd.conf "-u" "ntpd"
+                           #$@(if allow-large-adjustment?
+                                  '("-g")
+                                  '()))
+                     #:log-file "/var/log/ntpd.log"))
+           (stop #~(make-kill-destructor))))))
 
 (define %ntp-accounts
   (list (user-account
diff --git a/tests/networking.scm b/tests/networking.scm
index f2421370d2..fbf8db7a02 100644
--- a/tests/networking.scm
+++ b/tests/networking.scm
@@ -43,17 +43,6 @@ (define %ntp-server-sample
   "server some.ntp.server.org iburst version 3 maxpoll 16 prefer"
   (ntp-server->string %ntp-server-sample))
 
-(test-equal "ntp configuration servers deprecated form"
-  (ntp-configuration-servers
-   (ntp-configuration
-    (servers (list "example.pool.ntp.org"))))
-  (ntp-configuration-servers
-   (ntp-configuration
-    (servers (list (ntp-server
-                    (type 'server)
-                    (address "example.pool.ntp.org")
-                    (options '())))))))
-
 \f
 ;;;
 ;;; OpenNTPD
-- 
2.39.1





  parent reply	other threads:[~2023-02-27  0:12 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-27  0:10 [bug#61829] [PATCH 00/11] Purge pre-1.3.0 deprecated procedures & variables Bruno Victal
2023-02-27  0:11 ` [bug#61829] [PATCH 01/11] gnu: Purge pre-1.3.0 deprecated packages Bruno Victal
2023-02-28 12:52   ` Simon Tournier
2023-03-02  2:29     ` Bruno Victal
2023-03-03 16:29       ` [bug#61829] [PATCH 00/11] Purge pre-1.3.0 deprecated procedures & variables Ludovic Courtès
2023-03-03 18:57       ` [bug#61829] [PATCH 01/11] gnu: Purge pre-1.3.0 deprecated packages Simon Tournier
2023-02-27  0:11 ` [bug#61829] [PATCH 02/11] gnu: curl-minimal: Remove variable Bruno Victal
2023-02-28 12:54   ` Simon Tournier
2023-02-27  0:11 ` Bruno Victal [this message]
2023-02-27  0:11 ` [bug#61829] [PATCH 04/11] services: sddm: Remove 'sddm-service' procedure Bruno Victal
2023-02-27  0:11 ` [bug#61829] [PATCH 05/11] services: base: Remove 'console-keymap-service-type' variable Bruno Victal
2023-02-27  0:11 ` [bug#61829] [PATCH 06/11] services: base: Remove 'console-font-service' procedure Bruno Victal
2023-02-27  0:11 ` [bug#61829] [PATCH 07/11] services: guix-publish: Remove 'compression-level' field Bruno Victal
2023-02-27  0:11 ` [bug#61829] [PATCH 08/11] services: desktop: Remove 'gnome-desktop-service' procedure Bruno Victal
2023-02-27  0:11 ` [bug#61829] [PATCH 09/11] services: desktop: Remove 'mate-desktop-service' procedure Bruno Victal
2023-02-27  0:11 ` [bug#61829] [PATCH 10/11] services: desktop: Remove 'xfce-desktop-service' procedure Bruno Victal
2023-02-27  0:11 ` [bug#61829] [PATCH 11/11] guix: packages: Remove 'origin-sha256' procedure Bruno Victal
2023-02-28 12:57   ` Simon Tournier
2023-04-07 16:02 ` bug#61829: [PATCH 00/11] Purge pre-1.3.0 deprecated procedures & variables 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=2046be031f35d2eb4e9ed278c06a2e832d565671.1677456515.git.mirai@makinata.eu \
    --to=mirai@makinata.eu \
    --cc=61829@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).