From 268c1e8e9e519b57f9b8c271f806efba0d4651e1 Mon Sep 17 00:00:00 2001 From: Mehdi Abaakouk Date: Thu, 30 Nov 2017 17:07:27 +0100 Subject: [PATCH] storage: fix upgrade when password contains a % oslo.config doesn't support %{} or %() variable interpolation while ConfigParser does. So when a password contains a '%', it's fine for oslo.config But the Python ConfigParser will raise the exception. Since alembic use ConfigParser and not oslo.config, we have to escape the url ourself. This is not a big deal since, we don't want alembic doing variable interpolation. Change-Id: If7bfe7f082f4352fb49992a2216f2dd5b8993711 --- aodh/storage/impl_sqlalchemy.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aodh/storage/impl_sqlalchemy.py b/aodh/storage/impl_sqlalchemy.py index b9c465b68..bff6e12c3 100644 --- a/aodh/storage/impl_sqlalchemy.py +++ b/aodh/storage/impl_sqlalchemy.py @@ -92,7 +92,7 @@ class Connection(base.Connection): cfg = config.Config( "%s/sqlalchemy/alembic/alembic.ini" % os.path.dirname(__file__)) cfg.set_main_option('sqlalchemy.url', - self.conf.database.connection) + self.conf.database.connection.replace("%", "%%")) return cfg def upgrade(self, nocreate=False):