summary refs log tree commit diff
path: root/gnu/services/certbot.scm
diff options
context:
space:
mode:
authorClément Lassieur <clement@lassieur.org>2018-02-11 01:19:56 +0100
committerClément Lassieur <clement@lassieur.org>2018-02-22 21:43:54 +0100
commite216c797f7432cbf21f991b1eff97821ace17140 (patch)
tree84ebdb3c13f24eab9b1097941c612358140dd508 /gnu/services/certbot.scm
parenta2cb2bbc0ba984398dd79ff7bd37af8960f67ced (diff)
downloadguix-e216c797f7432cbf21f991b1eff97821ace17140.tar.gz
services: certbot: Add verbosity.
The certificate name wasn't displayed if it wasn't being renewed.

* gnu/services/certbot.scm (certbot-command): Print certificate name before
running the associated command.
Diffstat (limited to 'gnu/services/certbot.scm')
-rw-r--r--gnu/services/certbot.scm32
1 files changed, 19 insertions, 13 deletions
diff --git a/gnu/services/certbot.scm b/gnu/services/certbot.scm
index 51f5d719aa..f90e4f04b2 100644
--- a/gnu/services/certbot.scm
+++ b/gnu/services/certbot.scm
@@ -78,22 +78,28 @@
             (commands
              (map
               (match-lambda
-                (($ <certificate-configuration> name domains)
-                 (append
-                  (list certbot "certonly" "-n" "--agree-tos"
-                        "-m" email
-                        "--webroot" "-w" webroot
-                        "--cert-name" (or name (car domains))
-                        "-d" (string-join domains ","))
-                  (if rsa-key-size `("--rsa-key-size" ,rsa-key-size) '()))))
+                (($ <certificate-configuration> custom-name domains)
+                 (let ((name (or custom-name (car domains))))
+                   (append
+                    (list name certbot "certonly" "-n" "--agree-tos"
+                          "-m" email
+                          "--webroot" "-w" webroot
+                          "--cert-name" name
+                          "-d" (string-join domains ","))
+                    (if rsa-key-size `("--rsa-key-size" ,rsa-key-size) '())))))
               certificates)))
        (program-file
         "certbot-command"
-        #~(let ((code 0))
-            (for-each
-             (lambda (command)
-               (set! code (or (apply system* command) code)))
-             '#$commands) code))))))
+        #~(begin
+            (use-modules (ice-9 match))
+            (let ((code 0))
+              (for-each
+               (match-lambda
+                 ((name . command)
+                  (begin
+                    (format #t "Acquiring or renewing certificate: ~a~%" name)
+                    (set! code (or (apply system* command) code)))))
+               '#$commands) code)))))))
 
 (define (certbot-renewal-jobs config)
   (list