Skip to content

Commit 16014c5

Browse files
author
Joseph Palermo
committed
When performing a major version upgrade, find the current package dir that matches the major postgres version being upgraded from.
If no package dir exists, because they are making a large upgrade jump, print an error and exit.
1 parent 4493258 commit 16014c5

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

jobs/postgres/templates/pgconfig.sh.erb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,11 @@ pgversion_upgrade_from=postgres-unknown
2626
if [ -f "${VERSION_FILE}" ]; then
2727
pgversion_upgrade_from=$(cat ${VERSION_FILE})
2828
DATA_DIR_OLD="${PG_STORE_DIR}/${pgversion_upgrade_from}"
29-
PACKAGE_DIR_OLD=/var/vcap/packages/${pgversion_upgrade_from}
29+
PACKAGE_DIR_OLD=(/var/vcap/packages/${pgversion_upgrade_from%.*}*)
30+
if [ ! -d "${PACKAGE_DIR_OLD}" ]; then
31+
echo "Unable to find older postgres package to use for major upgrade. Upgrade to and older version first."
32+
exit 1
33+
fi
3034
fi
3135
<%
3236
if !['rfc3339', 'deprecated'].include?(p('databases.logging.format.timestamp'))

0 commit comments

Comments
 (0)