all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Oleg Pykhalov <go.wigust@gmail.com>
To: 33836@debbugs.gnu.org
Subject: [bug#33836] [PATCH] services: zabbix-front-end: Show location in messages.
Date: Sun, 23 Dec 2018 18:36:33 +0300	[thread overview]
Message-ID: <20181223153633.13009-1-go.wigust@gmail.com> (raw)
In-Reply-To: <874lb45nov.fsf@gmail.com>

* 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
-@code{db-password} for security in @code{zabbix-front-end-configuration}.")
-                           db-password)) "';
+                           (display-hint (format #f
+                                                 "~{~a: ~}Consider using
+@code{db-secret-file} instead of @code{db-password} and unset
+@code{db-password} 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	other threads:[~2018-12-23 15:38 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-22 20:38 [bug#33836] [PATCH 0/2] location in define-configuration Oleg Pykhalov
2018-12-22 20:42 ` [bug#33836] [PATCH 1/2] services: configuration: Add location Oleg Pykhalov
2018-12-22 20:42   ` [bug#33836] [PATCH 2/2] services: zabbix-front-end: Show location in messages Oleg Pykhalov
2018-12-23 14:21   ` [bug#33836] [PATCH 1/2] services: configuration: Add location Oleg Pykhalov
2018-12-23 15:36     ` Oleg Pykhalov [this message]
2018-12-26 17:31       ` [bug#33836] [PATCH] services: zabbix-front-end: Show location in messages Ludovic Courtès
2018-12-23 15:40     ` [bug#33836] [PATCH 1/2] services: configuration: Add location Oleg Pykhalov
2018-12-26 17:30       ` Ludovic Courtès
2019-02-15 22:24         ` Ludovic Courtès
2019-02-28 22:39           ` [bug#33836] [PATCH 0/2] Apply suggestions Oleg Pykhalov
2019-02-28 22:40             ` [bug#33836] [PATCH 1/2] services: configuration: Add '%location' Oleg Pykhalov
2019-02-28 22:40             ` [bug#33836] [PATCH 2/2] services: zabbix-front-end: Show location in messages Oleg Pykhalov
2019-03-10 17:21             ` [bug#33836] [PATCH 0/2] Apply suggestions Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181223153633.13009-1-go.wigust@gmail.com \
    --to=go.wigust@gmail.com \
    --cc=33836@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.