Package: patroni
Severity: normal

Dear Maintainer,

*** Reporter, please consider answering these questions, where appropriate ***

   * What led up to the situation?

I tried to use patroni with a custom data-directory for PostgreSQL, and ran 
into strange failures during bootstrap.

Note: I did try this on a Ubuntu 20.04 system, and on a different system than 
the one I'm reporting this bug from.
I could see that the problem is also present in the latest Debian package 
though, so reporting it here.

   * What exactly did you do (or not do) that was effective (or
     ineffective)?

Sticking to the default data-directory 
(/var/lib/postgresql/<version>/<clustername>) worked okay,
but trying a custom data-dir triggers the failure

   * What was the outcome of this action?

Failure messages, mixup between the intended (custom) data-dir and the default 
one which is still used in Postgres.

   * What outcome did you expect instead?

No failure.


The root-cause seems to be a bug in the pg_createcluster_patroni file of this 
package, which just ignores
the --datadir argument that patroni passes to it (namely, the DATADIR-variable 
is not being used anywhere)

Suggested diff for /usr/share/patroni/pg_createcluster_patroni
- pg_createcluster --start-conf=manual $VERSION $CLUSTER
+ pg_createcluster --start-conf=manual -d "${DATADIR}" $VERSION $CLUSTER

With that change, the custom data directory is also effectively used for a new 
cluster, which also worked in a test for me

Thanks

-- System Information:
Debian Release: bullseye/sid
  APT prefers focal-updates
  APT policy: (500, 'focal-updates'), (500, 'focal-security'), (500, 'focal'), 
(100, 'focal-backports')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 5.4.0-73-generic (SMP w/4 CPU cores)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE, 
TAINT_UNSIGNED_MODULE
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en_US 
(charmap=UTF-8)
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages patroni depends on:
ii  lsb-base                                                  11.1.0ubuntu2
ii  python3                                                   3.8.2-0ubuntu2
pn  python3-cdiff                                             <none>
ii  python3-click                                             7.0-3
pn  python3-dateutil                                          <none>
pn  python3-etcd | python3-consul | python3-kazoo | python3-  <none>
ii  python3-pkg-resources                                     45.2.0-1
pn  python3-prettytable                                       <none>
ii  python3-psutil                                            5.5.1-1ubuntu4
pn  python3-psycopg2                                          <none>
ii  python3-six                                               1.14.0-2
pn  python3-tzlocal                                           <none>
ii  python3-urllib3                                           1.25.8-2ubuntu0.1
ii  python3-yaml                                              5.3.1-1ubuntu0.1

Versions of packages patroni recommends:
ii  iproute2  5.5.0-1ubuntu1

Versions of packages patroni suggests:
pn  etcd-server | consul | zookeeperd  <none>
pn  haproxy                            <none>
pn  patroni-doc                        <none>
pn  postgresql                         <none>
pn  vip-manager                        <none>

Reply via email to