[postgresql] postgresql-setup: ignore misconfigure pg_hba.conf when upgrading
Pavel Raiskup
praiskup at fedoraproject.org
Mon Dec 16 13:44:47 UTC 2013
commit 85e0b076bcefa1b6374677925e03773cd4721aa2
Author: Jozef Mlich <jmlich at redhat.com>
Date: Fri Dec 13 09:12:08 2013 +0100
postgresql-setup: ignore misconfigure pg_hba.conf when upgrading
Resolves: #1040364
Version: 9.3.2-2
postgresql-setup | 25 ++++++++++++++++++++++++-
postgresql.spec | 5 ++++-
2 files changed, 28 insertions(+), 2 deletions(-)
---
diff --git a/postgresql-setup b/postgresql-setup
index a755e11..7400890 100644
--- a/postgresql-setup
+++ b/postgresql-setup
@@ -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"
diff --git a/postgresql.spec b/postgresql.spec
index 5f51f94..cbc387e 100644
--- a/postgresql.spec
+++ b/postgresql.spec
@@ -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 at 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 at 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
More information about the scm-commits
mailing list