Your message dated Thu, 07 May 2020 12:04:02 +0000 with message-id <[email protected]> and subject line Bug#953162: fixed in patroni 1.6.5-2 has caused the Debian Bug report #953162, regarding rerunning pg_createconfig_patroni --force will keep on increasing the port number or fail if reusing the same port to be marked as done.
This means that you claim that the problem has been dealt with. If this is not the case it is now your responsibility to reopen the Bug report if necessary, and/or fix the problem forthwith. (NB: If you are a system administrator and have no idea what this message is talking about, this may indicate a serious mail system misconfiguration somewhere. Please contact [email protected] immediately.) -- 953162: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=953162 Debian Bug Tracking System Contact [email protected] with problems
--- Begin Message ---Source: patroni Version: 1.6.4-1 Severity: minor Tags: patch Within the context of devops it would be important if `pg_createconfig_patroni` were idempotent. That is, if it would re-create the same configuration file given the same input parameters. Currently it is impossible to achieve idempotence with `pg_createconfig_patroni` because it will check if a given port is already used and fail, or if no port is given assign a new port unconditionally, no matter if the given cluster is already configured and running or not. I suggest to: 1. if a port is given and matches an already running cluster, then allow the port 2. if no port is given, then determine whether the given cluster is already running and reuse the running port So instead of this: if [ -z "$PORT" ]; then # try to guess next free port PORT=$(($(pg_lsclusters | awk '{print $3}' | grep -v Port | sort -n | tail -1) + 1)) if [ "$PORT" -eq 1 ]; then # No cluster exists yet, use default port PORT=5432 fi else # validate specified port pg_lsclusters | awk '{print $3}' | grep -q $PORT && echo "Port $PORT already in use" && exit 1 fi I suggest to do this: # find port of the cluster if it is already running EXISTING_PORT=$(pg_lsclusters | tail -n +2 | grep -E "^$VERSION[[:space:]]+$CLUSTER[[:space:]]+" | awk '{print $3}' ) if [ -z "$PORT" ]; then # no port was specified if [ -n "$EXISTING_PORT" ]; then # if our cluster is already running yet, then reuse the same port PORT="$EXISTING_PORT" else # if our cluster isn't running yet, then try to guess next free port PORT=$(($(pg_lsclusters | tail -n +2 | awk '{print $3}' | sort -n | tail -1) + 1)) if [ "$PORT" -eq 1 ]; then # No cluster exists yet, use default port PORT=5432 fi fi else # validate specified port if [ "$PORT" = "$EXISTING_PORT" ]; then # reuse existing port true else # fail if port already in use pg_lsclusters | awk '{print $3}' | grep -q $PORT && echo "Port $PORT already in use" && exit 1 fi fi Thanks, *t -- System Information: Debian Release: 10.3 APT prefers stable APT policy: (500, 'stable') Architecture: amd64 (x86_64) Foreign Architectures: i386 Kernel: Linux 4.19.0-8-amd64 (SMP w/8 CPU cores) Locale: LANG=de_CH.utf8, LC_CTYPE=de_CH.utf8 (charmap=UTF-8), LANGUAGE=de_CH:de (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Init: systemd (via /run/systemd/system) LSM: AppArmor: enabled
--- End Message ---
--- Begin Message ---Source: patroni Source-Version: 1.6.5-2 Done: Michael Banck <[email protected]> We believe that the bug you reported is fixed in the latest version of patroni, which is due to be installed in the Debian FTP archive. A summary of the changes between this version and the previous one is attached. Thank you for reporting the bug, which will now be closed. If you have further comments please address them to [email protected], and the maintainer will reopen the bug report if appropriate. Debian distribution maintenance software pp. Michael Banck <[email protected]> (supplier of updated patroni package) (This message was generated automatically at their request; if you believe that there is a problem with it please contact the archive administrators by mailing [email protected]) -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 Format: 1.8 Date: Thu, 07 May 2020 13:41:32 +0200 Source: patroni Architecture: source Version: 1.6.5-2 Distribution: unstable Urgency: medium Maintainer: Debian PostgreSQL Maintainers <[email protected]> Changed-By: Michael Banck <[email protected]> Closes: 953162 Changes: patroni (1.6.5-2) unstable; urgency=medium . * debian/pg_createconfig_patroni: Allow re-creating configuration file for already existing clusters/ports, patch by Tomas Pospisek (Closes: #953162). * debian/pg_createcluster_patroni: Pass $DATADIR variable to pg_createcluster if specified. * debian/[email protected]: Append scope to syslog identifier. * debian/pg_clonecluster_patroni: Pass $DATADIR variable to pg_createcluster. * debian/config.yml.in: Add some comments about option passing for pg_createcluster_patroni/pg_clonecluster_patroni. Checksums-Sha1: 067b46bc6b5d598f59b89981508955c0e1e50639 2831 patroni_1.6.5-2.dsc d94e045fdc74c7da6644922eb71da4833fc09ed1 18040 patroni_1.6.5-2.debian.tar.xz de982331d06b6dafcec3b01639b1bfbc3e2a2fd5 6680 patroni_1.6.5-2_source.buildinfo Checksums-Sha256: f9ef1a39a123fbba729e79ed4d2a2046037fd31b963f5d27fe1f6765387d4ac0 2831 patroni_1.6.5-2.dsc 5a5738ea9a381b6215e767c3f0731287fdcf3de9a4b5e78ecc21cbc0ba547466 18040 patroni_1.6.5-2.debian.tar.xz 7544661a509fdddd8bb69aab0aff4e23f2f26d52022abaa9ea9468d138166f08 6680 patroni_1.6.5-2_source.buildinfo Files: 8b7a9b42409c304a86457ed50a02aa57 2831 database optional patroni_1.6.5-2.dsc e9d96029061622bca3f570337a773443 18040 database optional patroni_1.6.5-2.debian.tar.xz faba5ce0511ffafa4ba649aa8e9a9a65 6680 database optional patroni_1.6.5-2_source.buildinfo -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEnKh3dJ+rLk+paGLs3GhqJ7Q0gbAFAl6z8/8ACgkQ3GhqJ7Q0 gbAPNA/+PXqZNVI/n4zu16vo4+80qHrIOVBS6TWrE0TmQMzgM2jcQk3W4hWvAsrM jxkvuAYsl7SRsz6COIczvlNX5QmxpxzaBpRfuWrtQCpZy1oyYV7AwIpOk3GtCiC5 rEJ6SfYO4DxzwbwBmR4Wkpofk5SLvFmjoUfeF0CgS4AwGdxKdXhklT1KIDWmlslr PxGq7iTQlr8jibsH0O1dHmWu+t1EaGX/EMJrYNtTlnTe8VOEaiObsCbNnh7VDcBX 7JXAEXY5A1Ci2sBPz7ejCm+5XCmD4vOISQ0ZmsM3ZXUCEMXdER94ShYhggnQsQRA T4cRWa64FU/Vnrsvb4X/bE9ceLdUQTsPXBfx4UVOUPG/ox5VNEBXatmlczAQrUc4 9qTnpuJRcR8fixw82IqsFlSZx5Cvan8CJFVAH5A7ZWwg5r0H02+0CasAVqrYjXWc EWtxoJc5xD3c7i4JEPDWHLcZw2Y+HMd2XSW3tpL8a37H5c5hZX4XUUtarfGBNH9z f4+m6KHTBdKHbplI9gJ8z+YqhxyIPbpp7VkWAKyoFKvyXizupxsS3exjdWbGDRws 6oxhVhDAbv+S6tvyO62HndR1Rz+pDwzVBaKhfDGa/kPY4nTodXkt1cSud4OttIwI AaLa4aQvBifSm3R/Fj8n01DW+fRR5fPQtWHv4NdooNaHkvK18v0= =jRtR -----END PGP SIGNATURE-----
--- End Message ---

