[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#29483] [PATCH] services: Add openntpd service.
From: |
Efraim Flashner |
Subject: |
[bug#29483] [PATCH] services: Add openntpd service. |
Date: |
Fri, 2 Mar 2018 16:02:11 +0200 |
User-agent: |
Mutt/1.9.3 (2018-01-21) |
On Mon, Feb 05, 2018 at 04:26:52PM +0100, Ludovic Courtès wrote:
> Heya Efraim,
>
> > +(define openntpd-shepherd-service
> > + (match-lambda
> > + (($ <openntpd-configuration> openntpd openntpd-listen-on
> > + openntpd-query-from openntpd-sensor openntpd-server
> > + openntpd-servers openntpd-constraint-from
> > + openntpd-constraints-from allow-large-adjustment?)
>
> This is error prone (you could be matching the wrong fields), could you
> change that to ‘match-record’?
>
I think this is the only thing left over. I compared my fields to
murmur, and for murmur we're looking at true/false or a single value.
Other than 'openntpd' and 'allow-large-adjustment?' each are lists
because they can all be lists, and I didn't want to make the logic phase
of generating the config file to be immensely long.
currently:
(match-lambda
(($ <openntpd-configuration> openntpd openntpd-listen-on
openntpd-query-from openntpd-sensor openntpd-server
openntpd-servers openntpd-constraint-from
openntpd-constraints-from allow-large-adjustment?)
(let ()
(define config
(string-join
(filter-map (lambda (field value)
(string-join
(map (cut string-append field <> "\n")
value)))
'("listen on " "query from " "sensor " "server " "servers "
"constraint from ")
(list openntpd-listen-on openntpd-query-from openntpd-sensor
openntpd-server openntpd-servers openntpd-constraint-from))
;; The 'constraints from' field needs to be enclosed in double quotes.
(string-join
(map (cut string-append "constraints from \"" <> "\"\n")
openntpd-constraints-from))))
Other wise I suppose I'd be looking more at [the following] for most fields:
(match-record
...
(if (not (null-list? openntpd-listen-on))
(lambda (value)
(string-append "listen on " value "\n")
value)
'())
...
currently to use the defaults I have
(service openntpd-service-type (openntpd-configuration))
which obviously isn't ideal.
--
Efraim Flashner <address@hidden> אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted
0001-services-Add-openntpd-service.patch
Description: Text document
signature.asc
Description: PGP signature
- [bug#29483] [PATCH] services: Add openntpd service.,
Efraim Flashner <=