Skip to content

Commit 66a4854

Browse files
FIX: exit upon failure to run the PostgreSQL 15 update
Exit code 77 is unnecessary for this update. Prior PG updates needed a second rebuild due to several legacy issues that have since been fixed. We now only require a single rebuild if the PG update succeeds.
1 parent 7d34842 commit 66a4854

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

templates/postgres.15.template.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,9 @@ run:
7171
chown -R postgres:postgres /shared/postgres_data
7272
chown -R postgres:postgres /var/run/postgresql
7373
elif [ -f /root/upgrade_postgres ]; then
74-
/root/upgrade_postgres
75-
rm /root/upgrade_postgres
74+
unset RETCODE
75+
/root/upgrade_postgres || RETCODE=$?
76+
[ ! $RETCODE ] && rm /root/upgrade_postgres || exit $RETCODE
7677
fi
7778
# Necessary to enable backups
7879
install -d -m 0755 -o postgres -g postgres /shared/postgres_backup
@@ -137,8 +138,6 @@ run:
137138
echo
138139
echo Old ${PG_MAJOR_OLD} database is stored at /shared/postgres_data_old
139140
echo -------------------------------------------------------------------------------------
140-
# Magic exit status to denote no failure
141-
exit 77
142141
fi
143142
144143
- replace:

templates/postgres.template.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,9 @@ run:
7171
chown -R postgres:postgres /shared/postgres_data
7272
chown -R postgres:postgres /var/run/postgresql
7373
elif [ -f /root/upgrade_postgres ]; then
74-
/root/upgrade_postgres
75-
rm /root/upgrade_postgres
74+
unset RETCODE
75+
/root/upgrade_postgres || RETCODE=$?
76+
[ ! $RETCODE ] && rm /root/upgrade_postgres || exit $RETCODE
7677
fi
7778
# Necessary to enable backups
7879
install -d -m 0755 -o postgres -g postgres /shared/postgres_backup
@@ -137,8 +138,6 @@ run:
137138
echo
138139
echo Old ${PG_MAJOR_OLD} database is stored at /shared/postgres_data_old
139140
echo -------------------------------------------------------------------------------------
140-
# Magic exit status to denote no failure
141-
exit 77
142141
fi
143142
144143
- replace:

0 commit comments

Comments
 (0)