postgresql-setup: ignore misconfigure pg_hba.conf when upgrading

Resolves: #1040364
Version: 9.3.2-2
This commit is contained in:
Jozef Mlich 2013-12-13 09:12:08 +01:00 committed by Pavel Raiskup
parent 3355515a99
commit 85e0b076bc
2 changed files with 28 additions and 2 deletions

View File

@ -153,6 +153,20 @@ upgrade(){
rm -rf "$PGDATAOLD"
mv "$PGDATA" "$PGDATAOLD" || exit 1
# Create configuration file for upgrade process
HBA_CONF_BACKUP="$PGDATAOLD/pg_hba.conf.postgresql-setup.`date +%s`"
HBA_CONF_BACKUP_EXISTS=0
if [ ! -f $HBA_CONF_BACKUP ]; then
mv "$PGDATAOLD/pg_hba.conf" "$HBA_CONF_BACKUP"
HBA_CONF_BACKUP_EXISTS=1
# For fluent upgrade 'postgres' user should be able to connect
# to any database without password. Temporarily, no other type
# of connection is needed.
/usr/bin/echo -e "local all postgres ident" > "$PGDATAOLD/pg_hba.conf"
fi
echo -n $"Upgrading database: "
# Create empty new-format database
@ -177,9 +191,18 @@ upgrade(){
script_result=1
fi
if [ x$HBA_CONF_BACKUP_EXISTS = x1 ]; then
mv -f "$HBA_CONF_BACKUP" "$PGDATAOLD/pg_hba.conf"
fi
if [ $script_result -eq 0 ]
then
echo $"OK"
echo $"OK"
echo
echo $"The configuration files was replaced by default configuration."
echo $"The previous configuration and data are stored in folder"
echo $PGDATAOLD.
else
# Clean up after failure
rm -rf "$PGDATA"

View File

@ -64,7 +64,7 @@ Summary: PostgreSQL client programs
Name: postgresql
%global majorversion 9.3
Version: 9.3.2
Release: 1%{?dist}
Release: 2%{?dist}
# The PostgreSQL license is very similar to other MIT licenses, but the OSI
# recognizes it as an independent license, so we do as well.
@ -1122,6 +1122,9 @@ fi
%endif
%changelog
* Thu Dec 12 2013 Jozef Mlich <jmlich@redhat.com> - 9.3.2-2
- don't fail if user has badly configure 'postgres' user access (#1040364)
* Thu Dec 05 2013 Jozef Mlich <jmlich@redhat.com> - 9.3.2-1
- update to 9.3.2 minor version per release notes:
http://www.postgresql.org/docs/9.3/static/release-9-3-2.html