* [bug#66609] [PATCH 0/1] services: admin: Export rottlog-configuration accessors.
@ 2023-10-18 15:08 Simon Tournier
2023-10-18 15:10 ` [bug#66609] [PATCH 1/1] " Simon Tournier
0 siblings, 1 reply; 5+ messages in thread
From: Simon Tournier @ 2023-10-18 15:08 UTC (permalink / raw)
To: 66609; +Cc: Simon Tournier, Yann Dupont
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* [bug#66609] [PATCH 1/1] services: admin: Export rottlog-configuration accessors.
2023-10-18 15:08 [bug#66609] [PATCH 0/1] services: admin: Export rottlog-configuration accessors Simon Tournier
@ 2023-10-18 15:10 ` Simon Tournier
2023-10-18 15:44 ` Bruno Victal
2023-10-20 22:21 ` [bug#66609] " Ludovic Courtès
0 siblings, 2 replies; 5+ messages in thread
From: Simon Tournier @ 2023-10-18 15:10 UTC (permalink / raw)
To: 66609; +Cc: Simon Tournier
* gnu/services/admin.scm (<rottlog-configuration>): Rename accessors
rottlog-rottlog to rottlog-configuration-rottlog, rottlog-rc-file to
rottlog-configuration-rc-file, rottlog-rotations to
rottlog-configuration-rotations, rottlog-jobs to rottlog-configuration-jobs.
(rottlog-etc, rottlog-jobs-or-default, rottlog-service-type): Adjust
accordingly.
---
gnu/services/admin.scm | 25 +++++++++++++++----------
1 file changed, 15 insertions(+), 10 deletions(-)
diff --git a/gnu/services/admin.scm b/gnu/services/admin.scm
index 5cf74c6e4d..ce27f7f7d3 100644
--- a/gnu/services/admin.scm
+++ b/gnu/services/admin.scm
@@ -3,6 +3,7 @@
;;; Copyright © 2016-2023 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2020 Brice Waegeneire <brice@waegenei.re>
;;; Copyright © 2023 Giacomo Leidi <goodoldpaul@autistici.org>
+;;; Copyright © 2023 Simon Tournier <zimon.toutoune@gmail.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -52,6 +53,10 @@ (define-module (gnu services admin)
rottlog-configuration
rottlog-configuration?
+ rottlog-configuration-rottlog
+ rottlog-configuration-rc-file
+ rottlog-configuration-rotations
+ rottlog-configuration-jobs
rottlog-service
rottlog-service-type
@@ -193,25 +198,25 @@ (define (default-jobs rottlog)
(define-record-type* <rottlog-configuration>
rottlog-configuration make-rottlog-configuration
rottlog-configuration?
- (rottlog rottlog-rottlog ;file-like
+ (rottlog rottlog-configuration-rottlog ;file-like
(default rottlog))
- (rc-file rottlog-rc-file ;file-like
+ (rc-file rottlog-configuration-rc-file ;file-like
(default (file-append rottlog "/etc/rc")))
- (rotations rottlog-rotations ;list of <log-rotation>
+ (rotations rottlog-configuration-rotations ;list of <log-rotation>
(default %default-rotations))
- (jobs rottlog-jobs ;list of <mcron-job>
+ (jobs rottlog-configuration-jobs ;list of <mcron-job>
(default #f)))
(define (rottlog-etc config)
`(("rottlog"
,(file-union "rottlog"
- (cons `("rc" ,(rottlog-rc-file config))
+ (cons `("rc" ,(rottlog-configuration-rc-file config))
(log-rotations->/etc-entries
- (rottlog-rotations config)))))))
+ (rottlog-configuration-rotations config)))))))
(define (rottlog-jobs-or-default config)
- (or (rottlog-jobs config)
- (default-jobs (rottlog-rottlog config))))
+ (or (rottlog-configuration-jobs config)
+ (default-jobs (rottlog-configuration-rottlog config))))
(define rottlog-service-type
(service-type
@@ -226,12 +231,12 @@ (define rottlog-service-type
;; Add Rottlog to the global profile so users can access
;; the documentation.
(service-extension profile-service-type
- (compose list rottlog-rottlog))))
+ (compose list rottlog-configuration-rottlog))))
(compose concatenate)
(extend (lambda (config rotations)
(rottlog-configuration
(inherit config)
- (rotations (append (rottlog-rotations config)
+ (rotations (append (rottlog-configuration-rotations config)
rotations)))))
(default-value (rottlog-configuration))))
--
2.38.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [bug#66609] [PATCH 1/1] services: admin: Export rottlog-configuration accessors.
2023-10-18 15:10 ` [bug#66609] [PATCH 1/1] " 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
1 sibling, 1 reply; 5+ messages in thread
From: Bruno Victal @ 2023-10-18 15:44 UTC (permalink / raw)
To: Simon Tournier; +Cc: 66609
Hi Simon,
On 2023-10-18 16:10, Simon Tournier wrote:
> * gnu/services/admin.scm (<rottlog-configuration>): Rename accessors
> rottlog-rottlog to rottlog-configuration-rottlog, rottlog-rc-file to
> rottlog-configuration-rc-file, rottlog-rotations to
> rottlog-configuration-rotations, rottlog-jobs to rottlog-configuration-jobs.
> (rottlog-etc, rottlog-jobs-or-default, rottlog-service-type): Adjust
> accordingly.
[…]
> +;;; Copyright © 2023 Simon Tournier <zimon.toutoune@gmail.com>
The changes don't look original enough to warrant this IMO, other
than that it LGTM.
--
Furthermore, I consider that nonfree software must be eradicated.
Cheers,
Bruno.
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#66609: [PATCH 1/1] services: admin: Export rottlog-configuration accessors.
2023-10-18 15:44 ` Bruno Victal
@ 2023-10-24 16:56 ` Simon Tournier
0 siblings, 0 replies; 5+ messages in thread
From: Simon Tournier @ 2023-10-24 16:56 UTC (permalink / raw)
To: Bruno Victal, Ludovic Courtès; +Cc: 66609-done
Hi,
On Wed, 18 Oct 2023 at 16:44, Bruno Victal <mirai@makinata.eu> wrote:
> The changes don't look original enough to warrant this IMO, other
> than that it LGTM.
Thanks Bruno and Ludo. Pushed as 7e4324575c. Closing.
Cheers,
simon
^ permalink raw reply [flat|nested] 5+ messages in thread
* [bug#66609] [PATCH 1/1] services: admin: Export rottlog-configuration accessors.
2023-10-18 15:10 ` [bug#66609] [PATCH 1/1] " Simon Tournier
2023-10-18 15:44 ` Bruno Victal
@ 2023-10-20 22:21 ` Ludovic Courtès
1 sibling, 0 replies; 5+ messages in thread
From: Ludovic Courtès @ 2023-10-20 22:21 UTC (permalink / raw)
To: Simon Tournier; +Cc: 66609
Hi!
Simon Tournier <zimon.toutoune@gmail.com> skribis:
> * gnu/services/admin.scm (<rottlog-configuration>): Rename accessors
> rottlog-rottlog to rottlog-configuration-rottlog, rottlog-rc-file to
> rottlog-configuration-rc-file, rottlog-rotations to
> rottlog-configuration-rotations, rottlog-jobs to rottlog-configuration-jobs.
> (rottlog-etc, rottlog-jobs-or-default, rottlog-service-type): Adjust
> accordingly.
LGTM!
Ludo’.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-10-24 18:15 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-18 15:08 [bug#66609] [PATCH 0/1] services: admin: Export rottlog-configuration accessors Simon Tournier
2023-10-18 15:10 ` [bug#66609] [PATCH 1/1] " 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
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.