Skip to content

Commit

Permalink
Fixes #22689: silent rudder-upgrade failure / plugins were not upgrad…
Browse files Browse the repository at this point in the history
…ed when upgrading from 7.2.5 to 7.3.1~nightly
  • Loading branch information
peckpeck authored and Jenkins CI committed May 5, 2023
1 parent 588a68d commit 1956312
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions rudder-server/SOURCES/rudder-server-postinst
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,24 @@ echo "`date` - Starting rudder-server post installation script" >> ${LOG_FILE}

# check if a db is configured
CREATE_DB="true"
if [ -f /opt/rudder/etc/rudder-web.properties ] && grep -q rudder.jdbc.url /opt/rudder/etc/rudder-web.properties
if [ -f /opt/rudder/etc/rudder-web.properties ]
then
# if it is an external DB, do not run
if ! grep -qE 'rudder.jdbc.url=jdbc:postgresql://(localhost|127\.0\.)' /opt/rudder/etc/rudder-web.properties
if grep -q rudder.jdbc.url /opt/rudder/etc/rudder-web.properties
then
echo "INFO: External database detected, skipping rudder-reports postinst"
CREATE_DB="false"
# if it is an external DB, do not run
if ! grep -qE 'rudder.jdbc.url=jdbc:postgresql://(localhost|127\.0\.)' /opt/rudder/etc/rudder-web.properties
then
echo "INFO: External database detected, skipping database creation"
CREATE_DB="false"
else
USER=$(grep rudder.jdbc.username /opt/rudder/etc/rudder-web.properties)
CHK_PG_USER=$(su postgres -c "psql -t -c \"select count(1) from pg_user where usename = '${USERNAME}'\"")
if [ ${CHK_PG_DB} -ne 0 ]
then
echo "INFO: Existing database detected, skipping database creation"
CREATE_DB="false"
fi
fi
fi
fi

Expand Down

0 comments on commit 1956312

Please sign in to comment.