File tree Expand file tree Collapse file tree
packaging/common/cfengine-hub Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -399,6 +399,10 @@ if [ ! -d $PREFIX/state/pg/data ]; then
399399 cp -a " $new_pgconfig_file " $PREFIX /state/pg/data/postgresql.conf
400400 chown cfpostgres $PREFIX /state/pg/data/postgresql.conf
401401 else
402+ # Always use the original pg_hba.conf file, it defines access control to PostgreSQL
403+ cp -a " $BACKUP_DIR /data/pg_hba.conf" " $PREFIX /state/pg/data/pg_hba.conf"
404+ chown cfpostgres " $PREFIX /state/pg/data/pg_hba.conf"
405+
402406 # Determine which postgresql.conf file to use and put it in the right place.
403407 if [ -f " $BACKUP_DIR /data/postgresql.conf.modified" ]; then
404408 # User-modified file from the previous old version of CFEngine exists, try to use it.
@@ -427,6 +431,14 @@ if [ ! -d $PREFIX/state/pg/data ]; then
427431 cp -a " $new_pgconfig_file " " $PREFIX /state/pg/data/postgresql.conf"
428432 chown cfpostgres " $PREFIX /state/pg/data/postgresql.conf"
429433 fi
434+
435+ # Preserve the recovery.conf file if it existed, it defines how this
436+ # PostgreSQL should behave as a slave (has to be done AFTER checking/writing
437+ # the postgresql.conf file above).
438+ if [ -f " $BACKUP_DIR /data/recovery.conf" ]; then
439+ cp -a " $BACKUP_DIR /data/recovery.conf" " $PREFIX /state/pg/data/recovery.conf"
440+ chown cfpostgres " $PREFIX /state/pg/data/recovery.conf"
441+ fi
430442 fi
431443fi
432444
You can’t perform that action at this time.
0 commit comments