From 0ab20b733be15f242ca03316eb7e3b1a9a50d971 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Tue, 14 Feb 2023 16:09:55 +0100 Subject: [PATCH] appsv2: mysqlshow is fucking dumb and returns exit code 0 when DB doesnt exists ... --- src/utils/resources.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/resources.py b/src/utils/resources.py index 47191fa36..96559d8d2 100644 --- a/src/utils/resources.py +++ b/src/utils/resources.py @@ -953,7 +953,7 @@ class DatabaseAppResource(AppResource): def db_exists(self, db_name): if self.dbtype == "mysql": - return os.system(f"mysqlshow '{db_name}' >/dev/null 2>/dev/null") == 0 + return os.system(f"mysqlshow | grep -q -w '{db_name}' 2>/dev/null") == 0 elif self.dbtype == "postgresql": return ( os.system(