guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#33836] [PATCH] services: zabbix-front-end: Show location in message


From: Oleg Pykhalov
Subject: [bug#33836] [PATCH] services: zabbix-front-end: Show location in messages.
Date: Sun, 23 Dec 2018 18:36:33 +0300

* gnu/services/monitoring.scm (zabbix-front-end-config): Show location in
messages.
---
 gnu/services/monitoring.scm | 26 +++++++++++++++++---------
 1 file changed, 17 insertions(+), 9 deletions(-)

diff --git a/gnu/services/monitoring.scm b/gnu/services/monitoring.scm
index 685641f11..90eda6561 100644
--- a/gnu/services/monitoring.scm
+++ b/gnu/services/monitoring.scm
@@ -29,6 +29,7 @@
   #:use-module (guix gexp)
   #:use-module (guix packages)
   #:use-module (guix records)
+  #:use-module (guix utils)
   #:use-module ((guix ui) #:select (display-hint))
   #:use-module (ice-9 match)
   #:use-module (ice-9 rdelim)
@@ -512,7 +513,7 @@ create it manually.")
 (define zabbix-front-end-config
   (match-lambda
     (($ <zabbix-front-end-configuration>
-        _ db-host db-port db-name db-user db-password db-secret-file
+        location _ db-host db-port db-name db-user db-password db-secret-file
         zabbix-host zabbix-port)
      (mixed-text-file "zabbix.conf.php"
                       "\
@@ -527,18 +528,25 @@ $DB['DATABASE'] = '" db-name "';
 $DB['USER']     = '" db-user "';
 $DB['PASSWORD'] = '" (if (string-null? db-password)
                          (if (string-null? db-secret-file)
-                             (raise (condition
-                                     (&message
-                                      (message "\
-you must provide either 'db-secret-file' or 'db-password'"))))
+                             (raise (make-compound-condition
+                                     (condition
+                                      (&message
+                                       (message "\
+you must provide either 'db-secret-file' or 'db-password'")))
+                                     (condition
+                                      (&error-location (location location)))))
                              (string-trim-both
                               (with-input-from-file db-secret-file
                                 read-string)))
                          (begin
-                           (display-hint "\
-Consider using @code{db-secret-file} instead of @code{db-password} and unset
address@hidden for security in @code{zabbix-front-end-configuration}.")
-                           db-password)) "';
+                           (display-hint (format #f
+                                                 "~{~a: ~}Consider using
address@hidden instead of @code{db-password} and unset
address@hidden for security in @code{zabbix-front-end-configuration}."
+                                                 (list (location-file location)
+                                                       (location-line location)
+                                                       (location-column 
location))))
+db-password)) "';
 
 // Schema name. Used for IBM DB2 and PostgreSQL.
 $DB['SCHEMA'] = '';
-- 
2.20.1






reply via email to

[Prev in Thread] Current Thread [Next in Thread]