GNU bug report logs - #73196
[PATCH] services: postgresql-role: Add support for password files.

Previous Next

Package: guix-patches;

Reported by: Giacomo Leidi <goodoldpaul <at> autistici.org>

Date: Thu, 12 Sep 2024 11:26:01 UTC

Severity: normal

Tags: patch

Done: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #64 received at 73196-done <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: paul <goodoldpaul <at> autistici.org>
Cc: Ludovic Courtès <ludo <at> gnu.org>, 73196-done <at> debbugs.gnu.org
Subject: Re: bug#73196: [PATCH] services: postgresql-role: Add support for
 password files.
Date: Fri, 02 May 2025 15:33:40 +0900
Hi Paul,

paul <goodoldpaul <at> autistici.org> writes:

> Hi Maxim,
>
> I should have addressed all your remaining comments. I'm about to send
> a v8, hopefully this will be the correct one :) thank you a lot for
> your help

Thanks!  I've made a few cosmetic changes, e.g.:

--8<---------------cut here---------------start------------->8---
3 files changed, 18 insertions(+), 18 deletions(-)
doc/guix.texi              |  5 +++--
gnu/services/databases.scm | 17 +++++++++--------
gnu/tests/databases.scm    | 14 ++++++--------

modified   doc/guix.texi
@@ -27805,8 +27805,9 @@ Database Services
 
 @item @code{shepherd-requirement} (default: @code{'(user-processes postgres)})
 
-Set additional Shepherd services dependencies to the provisioned
-Shepherd service.
+The Shepherd services dependencies to use.  Add extra dependencies to
+@code{%default-postgresql-role-shepherd-requirement} to extend its
+value.
 
 @item @code{roles} (default: @code{'()})
 The initial PostgreSQL roles to create.
modified   gnu/services/databases.scm
@@ -417,14 +417,15 @@ (define %default-postgresql-role-shepherd-requirement
 (define-record-type* <postgresql-role-configuration>
   postgresql-role-configuration make-postgresql-role-configuration
   postgresql-role-configuration?
-  (host                  postgresql-role-configuration-host ;string
-                         (default "/var/run/postgresql"))
-  (shepherd-requirement  postgresql-role-configuration-shepherd-requirement ;list-of-symbols
-                         (default %default-postgresql-role-shepherd-requirement))
-  (log                   postgresql-role-configuration-log ;string
-                         (default "/var/log/postgresql_roles.log"))
-  (roles                 postgresql-role-configuration-roles
-                         (default '()))) ;list
+  (shepherd-requirement
+   postgresql-role-configuration-shepherd-requirement ;list-of-symbols
+   (default %default-postgresql-role-shepherd-requirement))
+  (host             postgresql-role-configuration-host ;string
+                    (default "/var/run/postgresql"))
+  (log              postgresql-role-configuration-log ;string
+                    (default "/var/log/postgresql_roles.log"))
+  (roles            postgresql-role-configuration-roles
+                    (default '()))) ;list
 
 (define (postgresql-create-roles config)
   ;; See: https://www.postgresql.org/docs/current/sql-createrole.html for the
modified   gnu/tests/databases.scm
@@ -259,21 +259,19 @@ (define (run-postgresql-test)
           (test-assert "database use fails without a password"
             (marionette-eval
              '(begin
-                (use-modules (gnu services herd)
-                             (ice-9 popen))
                 (setgid (passwd:gid (getpwnam "alice")))
                 (setuid (passwd:uid (getpw "alice")))
-                (let ((output
-                       (system* #$(file-append postgresql "/bin/psql") "-tA" "-h" "localhost" "-U" "a_database" "-c"
-                                "SELECT 1 FROM pg_database WHERE datname='a_database'")))
-                  (not (= output 0))))
+                (not (zero?
+                      (system* #$(file-append postgresql "/bin/psql")
+                               "-tA" "-h" "localhost" "-U" "a_database" "-c"
+                               (string-append "SELECT 1 FROM pg_database "
+                                              "WHERE datname='a_database'")))))
              marionette))
 
           (test-assert "database passwords are set"
             (marionette-eval
              '(begin
-                (use-modules (gnu services herd)
-                             (ice-9 popen))
+                (use-modules (ice-9 popen))
                 (setgid (passwd:gid (getpwnam "alice")))
                 (setuid (passwd:uid (getpw "alice")))
                 (setenv "PGPASSWORD"
--8<---------------cut here---------------end--------------->8---

ensured 'make check-system TESTS=postgresql' was still happy, and
pushed as commit 9d216d2ae9f.  Thank you!

-- 
Thanks,
Maxim




This bug report was last modified 57 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.