From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id UCF6BZ4IZWV/UQEAauVa8A:P1 (envelope-from ) for ; Mon, 27 Nov 2023 22:22:38 +0100 Received: from aspmx1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id UCF6BZ4IZWV/UQEAauVa8A (envelope-from ) for ; Mon, 27 Nov 2023 22:22:38 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id DA719133AB for ; Mon, 27 Nov 2023 22:22:37 +0100 (CET) Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=lease-up.com header.s=2017 header.b=iaDHQSXK; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Seal: i=1; s=key1; d=yhetil.org; t=1701120158; a=rsa-sha256; cv=none; b=HFeIX5C1XtI3nCve22w8ftGX3uoXJa/bmdcrtVOwTEC5BP8N5DWQiTFocl74xmw7ETlVrz zUqPMD9kE7W5WdLBFWn21+NJFjmW4E9gVMVkVIg05bn2lCCuflDjfcaDLX3taoBXLuXADE FZvUdQZQuH7FqmCTM+3d20C3aWRF7goJ7N4A6YzkS0W/wJ99YCZOSYeUC1cKEqwhzfBa8L HanXu4SKr6e9aEynLAUxjyXpijkRaT28OBhnP4xL7CwpjJwwLXR5xYArZJV7ri4ZXczhbR mX8vvqEQk3qLnVsJW8GIuLTG1nYJi/A2/4FTRaExH8P//5b/EIWnZ1WYq8ZGKg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=lease-up.com header.s=2017 header.b=iaDHQSXK; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1701120158; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=RnsOdyAb5wUj0CGc9nVNw/IVWd+TecNGBIOCIbw7HM8=; b=BitKZyX2yGyHrKo6N7t8F13+xnNzWQp0gckoaY9Mk7lQEjuK+mCMiasjqtsYas9UY7su02 6UPQAzeaJHM2+ZnB1hcmi2eCsRAxH8Vv7k7ybaz02dpTw1npzAqq4zEE801o/2r25JPXgJ p/GaR9BFPgiYZAgSkSB9qa9xx60uCMqtfrBDz4o1UXi4hd+FgM1epWw124uxjwO33BzHS0 K5TtISDVsDnf3kTIaFhsk1I/ih1448iY7rEGm+53w/KOm1w/zkpqMgcEEpPckp23vDPyLo 78FkTq4ECOdpIMw02rKo+Mb1hMu0ehvoi6PO0zh2RiDc2xn1DCun5h8f1Ico2w== Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r7j3H-0000zc-62; Mon, 27 Nov 2023 16:21:59 -0500 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 1r7j3F-0000yJ-58 for guix-patches@gnu.org; Mon, 27 Nov 2023 16:21:57 -0500 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 1r7j3E-0005nF-Sp for guix-patches@gnu.org; Mon, 27 Nov 2023 16:21:56 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1r7j3L-000194-BK for guix-patches@gnu.org; Mon, 27 Nov 2023 16:22:03 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#67497] [PATCH 3/4] In certbot service, reduce code duplication. Resent-From: Felix Lechner Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 27 Nov 2023 21:22:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 67497 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 67497@debbugs.gnu.org Cc: Bruno Victal , Felix Lechner Received: via spool by 67497-submit@debbugs.gnu.org id=B67497.17011200984346 (code B ref 67497); Mon, 27 Nov 2023 21:22:03 +0000 Received: (at 67497) by debbugs.gnu.org; 27 Nov 2023 21:21:38 +0000 Received: from localhost ([127.0.0.1]:44989 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r7j2w-00017w-68 for submit@debbugs.gnu.org; Mon, 27 Nov 2023 16:21:38 -0500 Received: from sail-ipv4.us-core.com ([208.82.101.137]:56770) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r7j2u-00017R-UB for 67497@debbugs.gnu.org; Mon, 27 Nov 2023 16:21:37 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=2017; bh=He5BdxLzrXx8Tx1 KMFb3ErmfgVyOv9pbVDeJ3mHo3fY=; h=references:in-reply-to:date:subject: cc:to:from; d=lease-up.com; b=iaDHQSXKrxZmnbcU/jOx81gRwwINwcAuAdxrnmo2 qq7EWOOCtD96F/FMVkvbiJSPk480Wm0NJ2nhWPBaDuqyn5w8qOoi4+06JfnRqXbj5p4MTd h67+ux7XgP5bYCY4C44syK749A/f6XH8WFJYR4vrVxYZ/RN679BybMHhjPs2g= Received: by sail-ipv4.us-core.com (OpenSMTPD) with ESMTPSA id 295fbbd1 (TLSv1.3:TLS_CHACHA20_POLY1305_SHA256:256:NO); Mon, 27 Nov 2023 21:21:29 +0000 (UTC) Received: from localhost (localhost [local]) by localhost (OpenSMTPD) with ESMTPA id 0cae772a; Mon, 27 Nov 2023 21:21:28 +0000 (UTC) Date: Mon, 27 Nov 2023 13:20:53 -0800 Message-ID: X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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: , Reply-to: Felix Lechner X-ACL-Warn: , Felix Lechner via Guix-patches From: Felix Lechner via Guix-patches via Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-Migadu-Scanner: mx13.migadu.com X-Migadu-Spam-Score: -4.63 X-Spam-Score: -4.63 X-Migadu-Queue-Id: DA719133AB X-TUID: iJFDxmXWU4OF The certbot command is can only be changed with a great deal of attention. The program branches early and constructs two separate invocations. Changes would generally have to be made in two places. Otherwise, a new bug might be introduced. This commit places the conditional inquestion inside the list so that future edits are more fool-proof. Change-Id: I4a54f8b78ff4722688de7772d3c26a6191d6ff89 --- gnu/services/certbot.scm | 58 +++++++++++++++++++--------------------- 1 file changed, 27 insertions(+), 31 deletions(-) diff --git a/gnu/services/certbot.scm b/gnu/services/certbot.scm index 0c45471659..8490a69a99 100644 --- a/gnu/services/certbot.scm +++ b/gnu/services/certbot.scm @@ -100,37 +100,33 @@ (define certbot-command csr authentication-hook cleanup-hook deploy-hook) (let ((name (or custom-name (car domains)))) - (if challenge - (append - (list name certbot "certonly" "-n" "--agree-tos" - "--manual" - (string-append "--preferred-challenges=" challenge) - "--cert-name" name - "--manual-public-ip-logging-ok" - "-d" (string-join domains ",")) - (if csr `("--csr" ,csr) '()) - (if email - `("--email" ,email) - '("--register-unsafely-without-email")) - (if server `("--server" ,server) '()) - (if rsa-key-size `("--rsa-key-size" ,rsa-key-size) '()) - (if authentication-hook - `("--manual-auth-hook" ,authentication-hook) - '()) - (if cleanup-hook `("--manual-cleanup-hook" ,cleanup-hook) '()) - (if deploy-hook `("--deploy-hook" ,deploy-hook) '())) - (append - (list name certbot "certonly" "-n" "--agree-tos" - "--webroot" "-w" webroot - "--cert-name" name - "-d" (string-join domains ",")) - (if csr `("--csr" ,csr) '()) - (if email - `("--email" ,email) - '("--register-unsafely-without-email")) - (if server `("--server" ,server) '()) - (if rsa-key-size `("--rsa-key-size" ,rsa-key-size) '()) - (if deploy-hook `("--deploy-hook" ,deploy-hook) '())))))) + (append + (list name + certbot + "certonly" + "-n" + "--agree-tos") + (if challenge + (append + (list "--manual" + (string-append "--preferred-challenges=" challenge) + "--manual-public-ip-logging-ok") + (if authentication-hook + (list "--manual-auth-hook" authentication-hook) + '()) + (if cleanup-hook + (list "--manual-cleanup-hook" cleanup-hook) + '())) + (list "--webroot" "-w" webroot)) + (list "--cert-name" name + "-d" (string-join domains ",")) + (if csr (list "--csr" csr) '()) + (if email + (list "--email" email) + (list "--register-unsafely-without-email")) + (if server (list "--server" server) '()) + (if rsa-key-size (list "--rsa-key-size" rsa-key-size) '()) + (if deploy-hook (list "--deploy-hook" deploy-hook) '()))))) certificates))) (program-file "certbot-command" -- 2.41.0