From 8087b4316319c2cd89c0ded9226f853fe0ed0ff0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Bidoul?= Date: Sun, 19 Nov 2023 11:34:07 +0100 Subject: [PATCH] Create baseonly db only if first install failed --- src/runboat/kubefiles/runboat-initialize.sh | 22 ++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/runboat/kubefiles/runboat-initialize.sh b/src/runboat/kubefiles/runboat-initialize.sh index 8deba16..43c59df 100755 --- a/src/runboat/kubefiles/runboat-initialize.sh +++ b/src/runboat/kubefiles/runboat-initialize.sh @@ -11,19 +11,11 @@ bash /runboat/runboat-clone-and-install.sh oca_wait_for_postgres # Drop database, in case we are reinitializing. -dropdb --if-exists $PGDATABASE -dropdb --if-exists $PGDATABASE-baseonly +dropdb --if-exists ${PGDATABASE} +dropdb --if-exists ${PGDATABASE}-baseonly ADDONS=$(manifestoo --select-addons-dir ${ADDONS_DIR} --select-include "${INCLUDE}" --select-exclude "${EXCLUDE}" list --separator=,) -# Create the baseonly database. -unbuffer $(which odoo || which openerp-server) \ - --data-dir=/mnt/data/odoo-data-dir \ - --db-template=template1 \ - -d ${PGDATABASE}-baseonly \ - -i base \ - --stop-after-init - # Try to install all addons, but do not fail in case of error, to let the build start # so users can work with the 'baseonly' database. unbuffer $(which odoo || which openerp-server) \ @@ -31,4 +23,12 @@ unbuffer $(which odoo || which openerp-server) \ --db-template=template1 \ -d ${PGDATABASE} \ -i ${ADDONS:-base} \ - --stop-after-init || exit 0 + --stop-after-init || \ +# Create the baseonly database if installation failed. +(dropdb --if-exists ${PGDATABASE} && \ +unbuffer $(which odoo || which openerp-server) \ + --data-dir=/mnt/data/odoo-data-dir \ + --db-template=template1 \ + -d ${PGDATABASE}-baseonly \ + -i base \ + --stop-after-init)