* debian/pg_createconfig_patroni: Add --port option and automatically assign
the next free pg-common port if not specified.
This commit is contained in:
parent
1331953756
commit
fc45e29545
2
debian/changelog
vendored
2
debian/changelog
vendored
|
@ -3,6 +3,8 @@ patroni (1.5.3-3) UNRELEASED; urgency=medium
|
|||
[ Michael Banck ]
|
||||
* debian/README.Debian: New file (Closes: #916186).
|
||||
* debian/config.yml.in: Add @PORT@ option.
|
||||
* debian/pg_createconfig_patroni: Add --port option and automatically assign
|
||||
the next free pg-common port if not specified.
|
||||
|
||||
-- Debian PostgreSQL Maintainers <team+postgresql@tracker.debian.org> Mon, 14 Jan 2019 22:29:11 +0100
|
||||
|
||||
|
|
13
debian/pg_createconfig_patroni
vendored
13
debian/pg_createconfig_patroni
vendored
|
@ -11,6 +11,10 @@ case $i in
|
|||
HOSTIP="${i#*=}"
|
||||
shift # past argument=value
|
||||
;;
|
||||
--port=*)
|
||||
PORT="${i#*=}"
|
||||
shift # past argument=value
|
||||
;;
|
||||
--force)
|
||||
FORCE="y"
|
||||
shift # past argument=value
|
||||
|
@ -26,6 +30,14 @@ if [ -z "$SCOPE" ]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$PORT" ]; then
|
||||
# try to guess next free port
|
||||
PORT=$(($(pg_lsclusters | awk '{print $3}' | grep -v Port | sort -n | tail -1) + 1))
|
||||
else
|
||||
# validate specified port
|
||||
pg_lsclusters | awk '{print $3}' | grep -q $PORT && (echo "Port $PORT already in use"; exit 1)
|
||||
fi
|
||||
|
||||
# support both '-' and '/' as separator
|
||||
if [ $(echo $SCOPE | grep -- -) ]
|
||||
then
|
||||
|
@ -78,6 +90,7 @@ cat /etc/patroni/config.yml.in | \
|
|||
sed -e s/@VERSION@/${VERSION}/g \
|
||||
-e s/@CLUSTER@/${CLUSTER}/g \
|
||||
-e s/@HOSTIP@/${HOSTIP}/g \
|
||||
-e s/@PORT@/${PORT}/g \
|
||||
>> $CONFIG_FILE
|
||||
|
||||
# Set permissions
|
||||
|
|
Loading…
Reference in a new issue