diff --git a/templates/odoo-deployment.yaml b/templates/odoo-deployment.yaml index 3675d7e..6301792 100644 --- a/templates/odoo-deployment.yaml +++ b/templates/odoo-deployment.yaml @@ -84,6 +84,15 @@ spec: # check below skips the odoo step when base is already # installed — fresh deploys still bootstrap correctly # because base isn't installed in a brand-new database. + # Init both vars to "" so `set -u` doesn't crash when + # the schema query returns nothing (fresh DB case — + # ir_module_module doesn't exist yet, so the inner + # query block is skipped, leaving BASE_INSTALLED + # unset). Without this, db-init crashlooped on every + # fresh deploy with: "BASE_INSTALLED: parameter not + # set". + IS_INIT="" + BASE_INSTALLED="" IS_INIT=$(PGPASSWORD="$PASSWORD" psql -h "$HOST" -p "$PORT" -U "$USER" -d "$DBNAME" -tAc \ "SELECT 1 FROM information_schema.tables WHERE table_schema='public' AND table_name='ir_module_module'" 2>/dev/null || true) if [ "$IS_INIT" = "1" ]; then