From: Simon Tournier <zimon.toutoune@gmail.com>
To: 66609@debbugs.gnu.org
Cc: Simon Tournier <zimon.toutoune@gmail.com>,
Yann Dupont <Yann.Dupont@univ-nantes.fr>
Subject: [bug#66609] [PATCH 0/1] services: admin: Export rottlog-configuration accessors.
Date: Wed, 18 Oct 2023 17:08:59 +0200 [thread overview]
Message-ID: <cover.1697641168.git.zimon.toutoune@gmail.com> (raw)
Hi,
In some cases, people have a template configuration, and then another
configuration with some specific ’log-rotation’ files. Then, they want to
custom-merge these configurations. Therefore, they need to access field
values of <rottlog-configuration>.
For one trivial example: replace ’log-rotation’ of syslog defined with
%rotated-files by some others – do not ask why. :-)
--8<---------------cut here---------------start------------->8---
(use-modules (gnu services base)
(gnu services admin)
(srfi srfi-1))
(define config-template (rottlog-configuration))
(define some-logs
(list (log-rotation
(files '("/var/log/foo"
"/var/log/bar"
"/var/log/baz"))
(frequency 'weekly)
(options `("rotate 16"
"sharedscripts"
,@%default-log-rotation-options)))
(log-rotation
(files '("/var/log/some-evil.log"))
(options `("rotate 4"
,@%default-log-rotation-options)))))
(define other-config (rottlog-configuration
(rotations some-logs)))
(define my-config
(rottlog-configuration
(inherit config-template)
(rotations (filter
(lambda (log)
(not (lset= eq? (log-rotation-files log) %rotated-files)))
(append-map rottlog-configuration-rotations
(list other-config
config-template))))))
--8<---------------cut here---------------end--------------->8---
Without this patch, it needs to rely on ’@@’ which is not nice.
--8<---------------cut here---------------start------------->8---
(define rottlog-configuration-rotations
(@@ (gnu services admin) rottlog-rotations))
--8<---------------cut here---------------end--------------->8---
Therefore, let export them! To stay consistent with the schema for naming,
the accessors are renamed rottlog-configuration-
Cheers,
simon
Simon Tournier (1):
services: admin: Export rottlog-configuration accessors.
gnu/services/admin.scm | 25 +++++++++++++++----------
1 file changed, 15 insertions(+), 10 deletions(-)
base-commit: 202c97c4ce2e948266b8b6ee4d80631adbfba92b
--
2.38.1
next reply other threads:[~2023-10-18 15:09 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-18 15:08 Simon Tournier [this message]
2023-10-18 15:10 ` [bug#66609] [PATCH 1/1] services: admin: Export rottlog-configuration accessors Simon Tournier
2023-10-18 15:44 ` Bruno Victal
2023-10-24 16:56 ` bug#66609: " Simon Tournier
2023-10-20 22:21 ` [bug#66609] " 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=cover.1697641168.git.zimon.toutoune@gmail.com \
--to=zimon.toutoune@gmail.com \
--cc=66609@debbugs.gnu.org \
--cc=Yann.Dupont@univ-nantes.fr \
/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).