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
(cherry picked from commit 268c1e8e9e)
This commit is contained in:
Mehdi Abaakouk 2017-11-30 17:07:27 +01:00 committed by Mehdi Abaakouk (sileht)
parent c08bc044cb
commit c77c0aac4d
1 changed files with 1 additions and 1 deletions

View File

@ -82,7 +82,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):