* debian/pg_createconfig_patroni: Add --endpoint option for explicit setting
of VIP_ENDPOINT, make dcs.yml parsing a bit more robust and add sanity checking for VIP_ENDPOINT.
This commit is contained in:
parent
f6b94358ba
commit
d0aa441487
5
debian/changelog
vendored
5
debian/changelog
vendored
|
@ -1,6 +1,9 @@
|
|||
patroni (1.6.1-2) UNRELEASED; urgency=medium
|
||||
|
||||
*
|
||||
[ Michael Banck ]
|
||||
* debian/pg_createconfig_patroni: Add --endpoint option for explicit setting
|
||||
of VIP_ENDPOINT, make dcs.yml parsing a bit more robust and add sanity
|
||||
checking for VIP_ENDPOINT.
|
||||
|
||||
-- Debian PostgreSQL Maintainers <team+postgresql@tracker.debian.org> Fri, 15 Nov 2019 19:49:57 +0100
|
||||
|
||||
|
|
20
debian/pg_createconfig_patroni
vendored
20
debian/pg_createconfig_patroni
vendored
|
@ -23,6 +23,10 @@ case $i in
|
|||
VIP_IP="${i#*=}"
|
||||
shift # past argument=value
|
||||
;;
|
||||
--endpoint=*)
|
||||
DCS_ENDPOINT="${i#*=}"
|
||||
shift # past argument=value
|
||||
;;
|
||||
*)
|
||||
# unknown option
|
||||
;;
|
||||
|
@ -110,10 +114,20 @@ if [ -n "$VIP_IP" ]; then
|
|||
echo "DCS type could not be determined from /etc/patroni/dcs.yml, cannot write VIP file"
|
||||
exit 1
|
||||
fi
|
||||
DCS_ENDPOINT="$(egrep -v '^[[:space:]]*$|^ *#' /etc/patroni/dcs.yml | grep 'host' | sed -r -e s/.*host:// -e s/-// -e 's/ //g' -e 's/^([0-9])/http:\/\/\1/')"
|
||||
if [ -z "$DCS_ENDPOINT" ]; then
|
||||
echo "DCS endpoint URL could not be determined from /etc/patroni/dcs.yml, cannot write VIP file"
|
||||
exit 1
|
||||
DCS_ENDPOINT="$(egrep -v '^[[:space:]]*$|^ *#' /etc/patroni/dcs.yml | egrep '(host|-)' | egrep '[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+' | sed -r -e s/.*host:// -e s/-// -e 's/ //g' -e 's/^([0-9])/http:\/\/\1/')"
|
||||
if [ -z "$DCS_ENDPOINT" ]; then
|
||||
echo "DCS endpoint URL could not be determined from /etc/patroni/dcs.yml and --endpoint not provided, cannot write VIP file"
|
||||
exit 1
|
||||
fi
|
||||
if [ $(echo "$DCS_ENDPOINT" | wc -l) != 1 ]; then
|
||||
echo "DCS endpoint URL could not be determined from /etc/patroni/dcs.yml and --endpoint not provided, cannot write VIP file"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
if ! $(echo "$DCS_ENDPOINT" | egrep -q '^http.*://[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+:[[:digit:]]+$'); then
|
||||
echo "DCS endpoint URL not in 'http://1.2.3.4:1234' format, cannot write VIP file"
|
||||
exit 1
|
||||
fi
|
||||
LISTEN_VIP=",$VIP_IP"
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue