debian: Use link files for postgresql conf files

This work is part of debian integration effort.
This focuses on new deployments.
There will be a task to handle upgrades.

Configuration for postgres now points to files outside
/etc/postgresql. When copying files from drbd, create links to the
real location.

Tests on AIO-SX:
Debian:
PASS: unlocked enabled available
CentOS:
Skip full test, but run snippet to prove it is just a refactor

Tests on AIO-DX:
Debian:
Can't test, integration not far enough
CentOS:
Skip test, infer from AIO-SX it is just a refactor

Depends-On: https://review.opendev.org/c/starlingx/ansible-playbooks/+/841305
Depends-On: https://review.opendev.org/c/starlingx/stx-puppet/+/840468
Story: 2009965
Task: 45390
Signed-off-by: Dan Voiculeasa <dan.voiculeasa@windriver.com>
Change-Id: I6243c96d55ebed52f57be8f9e9647d08098f0893
This commit is contained in:
Dan Voiculeasa
2022-05-17 14:56:15 +03:00
parent 8e37f8c86e
commit b7db52a81b

View File

@@ -564,7 +564,27 @@ start()
if [ ! -e "${ACTIVE_CONTROLLER_NOT_FOUND_FLAG}" ]
then
mkdir -p /etc/postgresql/
cp -p $CONFIG_DIR/postgresql/*.conf /etc/postgresql/
OS_ID=$(grep '^ID=' /etc/os-release | cut -f2- -d= | sed -e 's/\"//g')
if [ ${OS_ID} == "centos" ];
then
REAL_CONFIG_DIR=/etc/postgresql
elif [ ${OS_ID} == "debian" ];
then
REAL_CONFIG_DIR=/etc/postgresql/13/main
for f in ${CONFIG_DIR}/postgresql/*.conf ;
do
link_basename=$(basename ${f})
link=/etc/postgresql/${link_basename}
echo "Removing ${link} to allow link to be created"
rm ${link}
echo "Linking ${link} to ${REAL_CONFIG_DIR}/${link_basename}"
ln -s ${REAL_CONFIG_DIR}/${link_basename} ${link}
done
fi
cp -p ${CONFIG_DIR}/postgresql/*.conf ${REAL_CONFIG_DIR}/
if [ $? -ne 0 ]
then
fatal_error "Unable to copy .conf files to /etc/postgresql"