Allow skip the database server installation

This patch allows to skip the installation
of the database backend packages (MySQL or Postgres)
with the introduction of the INSTALL_DATABASE_SERVER_PACKAGES
variable (defaulted to True).
This is useful in such environments that do not require
to install the MySQL/Postgres server packages directly but using
a container serving that purpose, for those cases all the
remaining steps should be executed just skipping the
packages install.

Change-Id: I26628a31fdda3ce95ed04a2b7ae7b132c288581f
This commit is contained in:
Carlos Camacho 2022-01-07 15:30:56 +01:00
parent 4448f243f3
commit cc6e20b24d
2 changed files with 26 additions and 21 deletions

View File

@ -12,6 +12,7 @@ _XTRACE_DB_MYSQL=$(set +o | grep xtrace)
set +o xtrace set +o xtrace
MYSQL_DRIVER=${MYSQL_DRIVER:-PyMySQL} MYSQL_DRIVER=${MYSQL_DRIVER:-PyMySQL}
INSTALL_DATABASE_SERVER_PACKAGES=$(trueorfalse True INSTALL_DATABASE_SERVER_PACKAGES)
register_database mysql register_database mysql
@ -175,6 +176,7 @@ EOF
chmod 0600 $HOME/.my.cnf chmod 0600 $HOME/.my.cnf
fi fi
# Install mysql-server # Install mysql-server
if [[ "$INSTALL_DATABASE_SERVER_PACKAGES" == "True" ]]; then
if is_oraclelinux; then if is_oraclelinux; then
install_package mysql-community-server install_package mysql-community-server
elif is_fedora; then elif is_fedora; then
@ -188,6 +190,7 @@ EOF
else else
exit_distro_not_supported "mysql installation" exit_distro_not_supported "mysql installation"
fi fi
fi
} }
function install_database_python_mysql { function install_database_python_mysql {

View File

@ -13,7 +13,7 @@ set +o xtrace
MAX_DB_CONNECTIONS=${MAX_DB_CONNECTIONS:-200} MAX_DB_CONNECTIONS=${MAX_DB_CONNECTIONS:-200}
INSTALL_DATABASE_SERVER_PACKAGES=$(trueorfalse True INSTALL_DATABASE_SERVER_PACKAGES)
register_database postgresql register_database postgresql
@ -104,6 +104,7 @@ EOF
else else
sed -i "s/:root:\w\+/:root:$DATABASE_PASSWORD/" $pgpass sed -i "s/:root:\w\+/:root:$DATABASE_PASSWORD/" $pgpass
fi fi
if [[ "$INSTALL_DATABASE_SERVER_PACKAGES" == "True" ]]; then
if is_ubuntu; then if is_ubuntu; then
install_package postgresql install_package postgresql
elif is_fedora || is_suse; then elif is_fedora || is_suse; then
@ -114,6 +115,7 @@ EOF
else else
exit_distro_not_supported "postgresql installation" exit_distro_not_supported "postgresql installation"
fi fi
fi
} }
function install_database_python_postgresql { function install_database_python_postgresql {