Package: patroni
Version: 3.2.1-1
Found this problem on Ubuntu, but as I see in #930016
pg_createconfig_patroni is maintained here.
I'm using etcd with TLS, so I've added cacert and other options to dcs.yml:
etcd3:
cacert: "/var/lib/etcd/investplatform.pki/ca.pem"
cert: "/var/lib/etcd/investplatform.pki/cf-pve2-patroni.pem"
key: "/var/lib/etcd/investplatform.pki/cf-pve2-patroni-key.pem"
protocol: https
hosts:
- 172.20.11.53:2379
- 172.20.11.51:2379
- 172.20.11.52:2379
Now pg_createconfig_patroni fails with the following error:
pg_createconfig_patroni --force --hostip=172.20.11.51 --port=5432
--vip=172.20.11.100 15 test
sed: -e expression #10, char 36: unknown option to `s'
sed: -e expression #6, char 18: unterminated `s' command
Both 15-test.vip and 15-test.yml appear empty. To fix this issue I've used
the patch in the attachment. Please, apply.
# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 22.04 LTS
Release: 22.04
Codename: jammy
--
Peter.
--- pg_createconfig_patroni 2024-01-09 20:31:50.087080942 +0000
+++ pg_createconfig_patroni 2024-01-09 20:54:28.046563402 +0000
@@ -141,7 +141,7 @@
exit 1
fi
VIP_KEY="/postgresql-common/${VERSION}-${CLUSTER}/leader"
- DCS_TYPE="$(egrep -v '^[[:space:]]*$|^ *#' /etc/patroni/dcs.yml | egrep -v '[[:space:]]-' | egrep '(etcd|consul|zookeeper)' | sed s/:.*//)"
+ DCS_TYPE="$(egrep -v '^[[:space:]]*$|^ *#' /etc/patroni/dcs.yml | egrep -v '[[:space:]]-' | egrep '(etcd(3)?|consul|zookeeper):' | sed s/:.*//)"
if [ -z "$DCS_TYPE" ]; then
echo "DCS type could not be determined from /etc/patroni/dcs.yml, cannot write VIP file"
exit 1
@@ -215,7 +215,7 @@
-e "s#@NETWORK@#${NETWORK}#g" \
-e "s/@API_PORT@/${API_PORT}/g" \
-e "s/@PORT@/${PORT}/g" \
- -e "s/@DCS_CONFIG@/${DCS_CONFIG}/g" \
+ -e "s#@DCS_CONFIG@#${DCS_CONFIG}#g" \
>> $CONFIG_FILE
# write vip configuration, if requested