From patchwork Wed Oct 18 15:08:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Simon Tournier X-Patchwork-Id: 1883 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 6859F27BBEA; Wed, 18 Oct 2023 16:10:03 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI, SPF_HELO_PASS autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 59FDE27BBE2 for ; Wed, 18 Oct 2023 16:09:58 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt8B1-0004wO-Ag; Wed, 18 Oct 2023 11:09:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8B0-0004wF-0J for guix-patches@gnu.org; Wed, 18 Oct 2023 11:09:38 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qt8Az-0006yd-Nl for guix-patches@gnu.org; Wed, 18 Oct 2023 11:09:37 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qt8BO-0003ao-DG; Wed, 18 Oct 2023 11:10:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#66609] [PATCH 0/1] services: admin: Export rottlog-configuration accessors. Resent-From: Simon Tournier Original-Sender: "Debbugs-submit" Resent-CC: Yann.Dupont@univ-nantes.fr, guix-patches@gnu.org Resent-Date: Wed, 18 Oct 2023 15:10:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 66609 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 66609@debbugs.gnu.org Cc: Simon Tournier , Yann Dupont X-Debbugs-Original-To: guix-patches@gnu.org X-Debbugs-Original-Xcc: Yann Dupont Received: via spool by submit@debbugs.gnu.org id=B.169764179513787 (code B ref -1); Wed, 18 Oct 2023 15:10:02 +0000 Received: (at submit) by debbugs.gnu.org; 18 Oct 2023 15:09:55 +0000 Received: from localhost ([127.0.0.1]:34435 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qt8BG-0003aI-M4 for submit@debbugs.gnu.org; Wed, 18 Oct 2023 11:09:54 -0400 Received: from lists.gnu.org ([2001:470:142::17]:56062) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qt8BB-0003Zw-G3 for submit@debbugs.gnu.org; Wed, 18 Oct 2023 11:09:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8Ae-0004tG-27 for guix-patches@gnu.org; Wed, 18 Oct 2023 11:09:16 -0400 Received: from mail-lj1-x235.google.com ([2a00:1450:4864:20::235]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qt8Ac-0006s0-JC for guix-patches@gnu.org; Wed, 18 Oct 2023 11:09:15 -0400 Received: by mail-lj1-x235.google.com with SMTP id 38308e7fff4ca-2bbbe81185dso18792941fa.0 for ; Wed, 18 Oct 2023 08:09:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697641752; x=1698246552; darn=gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=jogBxdV7pHz2gfvZNihmsonb7ki8c6/55lHvlnc/Vk8=; b=NklRqp3mI8gRJj9KWdYxlstqpRl7AEiEB0lYD3Dg/wsGK78I3LiOxaFnGmhuHc5IQC FRwBR3rD0LeEuAK04nhDN++9q24S2ge0Aos9c8UbCiFg2+68/3HZqfr6pyw7ImB9we8V vL/u/SBSHlrLWIKLwal4aOuT9une06mcQV0X8sRp48hBDrxjVOQGhhp99YNXkhEYXhwH cO8+3WdFLjCh0rN1O28tor+rtzsNXOGbM5ab1+vtbfw57ycdJ1TMCUxMHQNwpl0Di3rh Oi/NiRQ6GJZogfJQW8yX34gUsmPTWzoSvuCzQeyixE7pHbgfP7D8KvvBlSDBGRBxA8FR 66Ig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697641752; x=1698246552; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=jogBxdV7pHz2gfvZNihmsonb7ki8c6/55lHvlnc/Vk8=; b=jBEU26dPwNVeI55YmfOtqCNV6O10aye9MeJzAITSWJyZ5SgX1rrPe0Z0p15Z6uXcBL o1F+IAGFCikylGGrd9HsMHEtvnEwggKkpDznDup0egWnbFGhnITxp5ovDhsIzT+vL7od cQUQStv/SXbF1/GzWz703ndv/D0s91H5jAgQHBD7jQ/Wj5STW3jELLgMJ86W5yglT5JF TWb3m3c7D1p8Pv1s8vou7cBQNhm+Nb4WcGHNULrOdyhiEP46mkfNAgXcG4fjv9PARa9B NV6lGWA0VBUo5p/JUfOmlxPAoNebkq+VQgwpggpCJwFOmEM/71a0DyHdv1QMbnHGWNhg QHZQ== X-Gm-Message-State: AOJu0Yz1KV7sf4V7TD7sIPMP2Qpetr3q8VxdCv6wEZzQkNDCLTf5cLfj 0axb5ppZ7pqVD1eGL1/PBTETt/vyymE= X-Google-Smtp-Source: AGHT+IFinVB3fUSW4rzj27zzr6kv055gmZyKjoME8Q/shCC0VHk/ni9I6qk8HOonJWmaJ83SU5g++Q== X-Received: by 2002:a05:651c:115:b0:2bc:d505:2bf3 with SMTP id a21-20020a05651c011500b002bcd5052bf3mr4312525ljb.1.1697641752011; Wed, 18 Oct 2023 08:09:12 -0700 (PDT) Received: from localhost.localdomain ([193.48.40.241]) by smtp.gmail.com with ESMTPSA id r4-20020a05600c35c400b0040531f5c51asm1953260wmq.5.2023.10.18.08.09.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 08:09:09 -0700 (PDT) From: Simon Tournier Date: Wed, 18 Oct 2023 17:08:59 +0200 Message-Id: X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::235; envelope-from=zimon.toutoune@gmail.com; helo=mail-lj1-x235.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches 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 . 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