From patchwork Thu Feb 28 22:40:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleg Pykhalov X-Patchwork-Id: 1264 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id CF2D916CB6; Thu, 28 Feb 2019 22:42:06 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.0 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id 878FB16C8E for ; Thu, 28 Feb 2019 22:42:06 +0000 (GMT) Received: from localhost ([127.0.0.1]:47578 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gzUNS-00068I-5r for patchwork@mira.cbaines.net; Thu, 28 Feb 2019 17:42:06 -0500 Received: from eggs.gnu.org ([209.51.188.92]:55278) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gzUNP-000689-S9 for guix-patches@gnu.org; Thu, 28 Feb 2019 17:42:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gzUNP-0006mN-6y for guix-patches@gnu.org; Thu, 28 Feb 2019 17:42:03 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:42074) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gzUNP-0006m9-1C for guix-patches@gnu.org; Thu, 28 Feb 2019 17:42:03 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1gzUNO-0002h6-K8 for guix-patches@gnu.org; Thu, 28 Feb 2019 17:42:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#33836] [PATCH 1/2] services: configuration: Add '%location'. Resent-From: Oleg Pykhalov Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 28 Feb 2019 22:42:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 33836 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 33836@debbugs.gnu.org Received: via spool by 33836-submit@debbugs.gnu.org id=B33836.155139368510298 (code B ref 33836); Thu, 28 Feb 2019 22:42:02 +0000 Received: (at 33836) by debbugs.gnu.org; 28 Feb 2019 22:41:25 +0000 Received: from localhost ([127.0.0.1]:55615 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gzUMn-0002g2-1X for submit@debbugs.gnu.org; Thu, 28 Feb 2019 17:41:25 -0500 Received: from mail-lj1-f181.google.com ([209.85.208.181]:43997) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gzUMl-0002fo-Cm for 33836@debbugs.gnu.org; Thu, 28 Feb 2019 17:41:23 -0500 Received: by mail-lj1-f181.google.com with SMTP id z20so18630250ljj.10 for <33836@debbugs.gnu.org>; Thu, 28 Feb 2019 14:41:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=xj/HP3pP1mdjp/3EGOTdnnu6TsANx3mkRI5/jOgmtK4=; b=rozFrlhDmZs40xdAxyMdd7lnS9f1zBGq1+GlwC2wtVe+AloFU5/RLt/untFFxSHPi7 mq3XhBeE6Ad9NTzwo+n5NXx5KF7vvR79Fx/tJHnpeBn1WTOwf9izETJooq8GMcLfyKqS lLjbHKu3OL9FMmZEHO0BUm0EIwYd/xKlxYXJzfxw/wg6G5YgEouI0pn1glyEFdk+ogLq uQEbcFwVzOAxd3b7wN1S7Y+X6u3WMf1Ct36W3oimVX0ndGuU6T8tS35OMNoW/PjRN5Kh d83DzkTZnJdKFGi+f3dhXF0dqHlHnbX/hz+sBZgyjOQIO+OTRwykLU+EHDTUb62w4Nmp kfFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=xj/HP3pP1mdjp/3EGOTdnnu6TsANx3mkRI5/jOgmtK4=; b=SbhCyj6lBVJXlRvCXmzceVEPteOzYfWt71TXbsxMaJJ64w1mOW94ljlTrtdkqEGrMt jywzOFtUZMECA5r199aYpOQfMDWaVXwrjze8ISlvarXizTOYPH0v2pgn1bYdIcvdAwLw 41uw3M6F3oCefxs0d6choSGkr8fbgUYHmE7UZ7qHaBqP+bg6v370u7WCd3W7PzudwduN izWZWTMWvoacHvtqF1iEkAnymaBPnT3fmT83aXBaCR1vVvbf0hN+tr52XaNI6/2C0Gm/ jgB785Flyi221IONOdVldIjLeFMyWOIJRUGXIZKyRg4WqyKvg1yIENEKME7AAW+nWCNu Jnew== X-Gm-Message-State: APjAAAXmYl5DdXY/WpSUzHWDoZ8XXsMHQBrd21DYv/GriRY+2BrElhn5 PdTFanQI4jeRDQGJDDroRRBd08jl X-Google-Smtp-Source: APXvYqwUE86z+rfcxP0jtDzJl6vq/Rv8o6XfMgdFtxz6XyNkqLsNb7qhQjj3my8Qwivzd00dvMdhkQ== X-Received: by 2002:a2e:719:: with SMTP id 25mr768156ljh.122.1551393677158; Thu, 28 Feb 2019 14:41:17 -0800 (PST) Received: from localhost.localdomain (pppoe.95-55-181-170.dynamic.avangarddsl.ru. [95.55.181.170]) by smtp.gmail.com with ESMTPSA id w6sm1109204lfl.14.2019.02.28.14.41.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 Feb 2019 14:41:16 -0800 (PST) From: Oleg Pykhalov Date: Fri, 1 Mar 2019 01:40:00 +0300 Message-Id: <20190228224001.27182-2-go.wigust@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190228224001.27182-1-go.wigust@gmail.com> References: <87k1i0itaj.fsf@gnu.org> <20190228224001.27182-1-go.wigust@gmail.com> MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * gnu/services/configuration.scm (define-configuration): Add '%location'. --- gnu/services/configuration.scm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/gnu/services/configuration.scm b/gnu/services/configuration.scm index 707944cbe0..90f12a8d39 100644 --- a/gnu/services/configuration.scm +++ b/gnu/services/configuration.scm @@ -22,6 +22,7 @@ #:use-module (guix packages) #:use-module (guix records) #:use-module (guix gexp) + #:use-module ((guix utils) #:select (source-properties->location)) #:autoload (texinfo) (texi-fragment->stexi) #:autoload (texinfo serialize) (stexi->texi) #:use-module (ice-9 match) @@ -129,6 +130,10 @@ #,(id #'stem #'% #'stem) #,(id #'stem #'make- #'stem) #,(id #'stem #'stem #'?) + (%location #,(id #'stem #'-location) + (default (and=> (current-source-location) + source-properties->location)) + (innate)) (field field-getter (default def)) ...) (define #,(id #'stem #'stem #'-fields) From patchwork Thu Feb 28 22:40:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Oleg Pykhalov X-Patchwork-Id: 1265 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id B72F216CB6; Thu, 28 Feb 2019 22:42:11 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, T_DKIM_INVALID,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id 4556B16C8E for ; Thu, 28 Feb 2019 22:42:11 +0000 (GMT) Received: from localhost ([127.0.0.1]:47584 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gzUNW-0006BD-TH for patchwork@mira.cbaines.net; Thu, 28 Feb 2019 17:42:10 -0500 Received: from eggs.gnu.org ([209.51.188.92]:55288) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gzUNQ-00068E-Qo for guix-patches@gnu.org; Thu, 28 Feb 2019 17:42:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gzUNP-0006n3-Ma for guix-patches@gnu.org; Thu, 28 Feb 2019 17:42:04 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:42075) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gzUNP-0006mk-HZ for guix-patches@gnu.org; Thu, 28 Feb 2019 17:42:03 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1gzUNP-0002hE-Ea for guix-patches@gnu.org; Thu, 28 Feb 2019 17:42:03 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#33836] [PATCH 2/2] services: zabbix-front-end: Show location in messages. Resent-From: Oleg Pykhalov Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 28 Feb 2019 22:42:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 33836 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 33836@debbugs.gnu.org Received: via spool by 33836-submit@debbugs.gnu.org id=B33836.155139368910315 (code B ref 33836); Thu, 28 Feb 2019 22:42:03 +0000 Received: (at 33836) by debbugs.gnu.org; 28 Feb 2019 22:41:29 +0000 Received: from localhost ([127.0.0.1]:55618 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gzUMr-0002gJ-Cm for submit@debbugs.gnu.org; Thu, 28 Feb 2019 17:41:29 -0500 Received: from mail-lj1-f176.google.com ([209.85.208.176]:42760) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gzUMp-0002ft-Da for 33836@debbugs.gnu.org; Thu, 28 Feb 2019 17:41:28 -0500 Received: by mail-lj1-f176.google.com with SMTP id d14so18629045ljl.9 for <33836@debbugs.gnu.org>; Thu, 28 Feb 2019 14:41:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=3qBsgnDlGfXnFXEL45CJHBHC3aP3+5UxLzrsyB+M+ZQ=; b=sRa21eT1TJEhlCy89Ya/EkNPRNEdfVwDvHkPPLzM8Wta3kNwzqEISzTOoM6MqoulIk qt4FNy+5fsMNovlvYKzFtDcMdLHfb5R8og3dO7xOFdeCVpqYqq0tCqD/E/NAAN3Y5bV8 n27AEGz2lj7cK/RsiCdZiLlTZjjryGc33V55QALOkKNecRisbKQVnp+UQLQkxsMOFWlB GFKkeaULu13no+DOYvCtlCDdWqnDVqt99qePVLgAcKhi0XJY/z1bGGuiFkqzKwzj4D3C 82TgFCCcpRStFIio7QdPX2n34lgsuFdZUnUlMXeDO9xpvmMIlNaJwcBp5n3RGWv3sOSx hfMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=3qBsgnDlGfXnFXEL45CJHBHC3aP3+5UxLzrsyB+M+ZQ=; b=sC2F2pHHfV3ZCMi80dOrdlfwhKsNT3YzwgSVDrXFW9EmVhmn+yEFPaQauF+JXnRhyJ erDy/z1/nGRgXgj2efVehvy+uzGRDrEkXESQLU521FHvvGAjfvMtb07hCbP1ph8o4o33 +XKD0vn+nKnP08i8S7J1SYP3IWoebua8x1UDWgyhVY9IWdSJgdCewCD4/C2qYqcOd3BW KX0kgMepy53lxrnmdn+ijQG8Lzq8AIijb5MNIC6yUKMV9H4Vypkrr0KEThgh2WtSVp6c FfM+NHOAlYRb0bTa8pQMMju0Cg8MjVVCEJbUMen04JLV4hIgmbU0oT1ZOU35Hl2OcnRF WZ9g== X-Gm-Message-State: APjAAAUtt54VPPj0fp8yufb1NGZCbAY0IjfVaTp4l0gMneMnyEETydIM eHHgxS/d/5L7Kr2xNzD5uzfbrNKS X-Google-Smtp-Source: APXvYqzzO778UqPZ/0l18HGXMv3KD5aqlPG2YJh94pxVJMpQdEzYaBrlp6f4VracSmx6jFHph6natQ== X-Received: by 2002:a2e:54f:: with SMTP id 76mr783060ljf.20.1551393680304; Thu, 28 Feb 2019 14:41:20 -0800 (PST) Received: from localhost.localdomain (pppoe.95-55-181-170.dynamic.avangarddsl.ru. [95.55.181.170]) by smtp.gmail.com with ESMTPSA id w6sm1109204lfl.14.2019.02.28.14.41.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 Feb 2019 14:41:19 -0800 (PST) From: Oleg Pykhalov Date: Fri, 1 Mar 2019 01:40:01 +0300 Message-Id: <20190228224001.27182-3-go.wigust@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190228224001.27182-1-go.wigust@gmail.com> References: <87k1i0itaj.fsf@gnu.org> <20190228224001.27182-1-go.wigust@gmail.com> MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * gnu/services/monitoring.scm (zabbix-front-end-config): Show location in messages. --- gnu/services/monitoring.scm | 57 +++++++++++++++++++++---------------- 1 file changed, 33 insertions(+), 24 deletions(-) diff --git a/gnu/services/monitoring.scm b/gnu/services/monitoring.scm index 685641f110..101222bf2e 100644 --- a/gnu/services/monitoring.scm +++ b/gnu/services/monitoring.scm @@ -1,7 +1,7 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2018 Sou Bunnbu ;;; Copyright © 2018 Gábor Boskovits -;;; Copyright © 2018 Oleg Pykhalov +;;; Copyright © 2018, 2019 Oleg Pykhalov ;;; ;;; This file is part of GNU Guix. ;;; @@ -29,7 +29,8 @@ #:use-module (guix gexp) #:use-module (guix packages) #:use-module (guix records) - #:use-module ((guix ui) #:select (display-hint)) + #:use-module (guix utils) + #:use-module ((guix ui) #:select (display-hint G_)) #:use-module (ice-9 match) #:use-module (ice-9 rdelim) #:use-module (srfi srfi-26) @@ -509,13 +510,12 @@ create it manually.") (number 10051) "Zabbix server port.")) -(define zabbix-front-end-config - (match-lambda - (($ - _ db-host db-port db-name db-user db-password db-secret-file - zabbix-host zabbix-port) - (mixed-text-file "zabbix.conf.php" - "\ +(define (zabbix-front-end-config config) + (match-record config + (%location db-host db-port db-name db-user db-password db-secret-file + zabbix-host zabbix-port) + (mixed-text-file "zabbix.conf.php" + "\ string db-port) "'; $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'")))) - (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)) "'; +$DB['PASSWORD'] = '" (let ((file (location-file %location)) + (line (location-line %location)) + (column (location-column %location))) + (if (string-null? db-password) + (if (string-null? db-secret-file) + (raise (make-compound-condition + (condition + (&message + (message + (format #f "no '~A' or '~A' field in your '~A' record" + 'db-secret-file 'db-password + 'zabbix-front-end-configuration)))) + (condition + (&error-location + (location %location))))) + (string-trim-both + (with-input-from-file db-secret-file + read-string))) + (begin + (display-hint (format #f (G_ "~a:~a:~a: ~a: +Consider using @code{db-secret-file} instead of @code{db-password} for better +security.") file line column 'zabbix-front-end-configuration)) + db-password))) "'; // Schema name. Used for IBM DB2 and PostgreSQL. $DB['SCHEMA'] = ''; @@ -548,7 +557,7 @@ $ZBX_SERVER_PORT = '" (number->string zabbix-port) "'; $ZBX_SERVER_NAME = ''; $IMAGE_FORMAT_DEFAULT = IMAGE_FORMAT_PNG; -")))) +"))) (define %maintenance.inc.php ;; Empty php file to allow us move zabbix-frontend configs to ‘/etc/zabbix’