From f472c1b9e54e3ba820577db1bfb77a2e363e6d55 Mon Sep 17 00:00:00 2001 From: Slavi Pantaleev Date: Tue, 1 Jan 2019 14:02:31 +0200 Subject: [PATCH] Ensure psql returns a failure exit code when it fails Until now, if the .sql file contained invalid data, psql would choke on it, but still return an exit code of 0. This is very misleading. We need to pass `-v ON_ERROR_STOP=1` to make it exit with a proper error exit code when failures happen. --- roles/matrix-server/tasks/upgrade_postgres.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/matrix-server/tasks/upgrade_postgres.yml b/roles/matrix-server/tasks/upgrade_postgres.yml index e6d3415c9..7c60df3e7 100644 --- a/roles/matrix-server/tasks/upgrade_postgres.yml +++ b/roles/matrix-server/tasks/upgrade_postgres.yml @@ -94,7 +94,7 @@ --network={{ matrix_docker_network }} \ --env-file={{ matrix_environment_variables_data_path }}/env-postgres-pgsql-docker \ -v {{ postgres_dump_dir }}:/in:ro \ - {{ matrix_postgres_docker_image_latest }} psql -h matrix-postgres -f /in/{{ postgres_dump_name }} + {{ matrix_postgres_docker_image_latest }} psql -v ON_ERROR_STOP=1 -h matrix-postgres -f /in/{{ postgres_dump_name }} - name: Delete Postgres database dump file file: