services: cuirass: Fix activation.
authorMathieu Othacehe <othacehe@gnu.org>
Fri, 2 Oct 2020 12:58:01 +0000 (14:58 +0200)
committerMathieu Othacehe <othacehe@gnu.org>
Fri, 2 Oct 2020 12:58:01 +0000 (14:58 +0200)
Fixes: <https://issues.guix.gnu.org/43760>.

* gnu/services/cuirass.scm (cuirass-activation): Do not create
queries-log-file and web-queries-log-file if the corresponding config file are
unset.

gnu/services/cuirass.scm

index d4faf78..a50f583 100644 (file)
             (chown #$db uid gid)
             (chown #$log uid gid)
 
-            (call-with-output-file #$queries-log-file (const #t))
-            (call-with-output-file #$web-queries-log-file (const #t))
-
-            (chown #$queries-log-file uid gid)
-            (chown #$web-queries-log-file uid gid))))))
+            (let ((queries-log-file #$queries-log-file))
+              (when queries-log-file
+                (call-with-output-file queries-log-file (const #t))
+                (chown #$queries-log-file uid gid)))
+
+            (let ((web-queries-log-file #$web-queries-log-file))
+              (when web-queries-log-file
+                (call-with-output-file web-queries-log-file (const #t))
+                (chown web-queries-log-file uid gid))))))))
 
 (define (cuirass-log-rotations config)
   "Return the list of log rotations that corresponds to CONFIG."