From 89dda11b5649d28ccafe83a2911e09ed857728ab Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Mon, 17 Jan 2022 23:58:04 +0100 Subject: [PATCH] postgresql migration: Attempt to fix cluster upgrade, complaining that cluster for 13 already existed, suspecting a race condition maybe --- src/migrations/0023_postgresql_11_to_13.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/migrations/0023_postgresql_11_to_13.py b/src/migrations/0023_postgresql_11_to_13.py index 145f15558..8f03f8c5f 100644 --- a/src/migrations/0023_postgresql_11_to_13.py +++ b/src/migrations/0023_postgresql_11_to_13.py @@ -1,4 +1,5 @@ import subprocess +import time from moulinette import m18n from yunohost.utils.error import YunohostError, YunohostValidationError @@ -42,9 +43,11 @@ class MyMigration(Migration): ) self.runcmd("systemctl stop postgresql") + time.sleep(3) self.runcmd( "LC_ALL=C pg_dropcluster --stop 13 main || true" ) # We do not trigger an exception if the command fails because that probably means cluster 13 doesn't exists, which is fine because it's created during the pg_upgradecluster) + time.sleep(3) self.runcmd("LC_ALL=C pg_upgradecluster -m upgrade 11 main") self.runcmd("LC_ALL=C pg_dropcluster --stop 11 main") self.runcmd("systemctl start postgresql")