diff options
author | Zuul <zuul@review.opendev.org> | 2021-08-31 20:47:28 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2021-08-31 20:47:28 +0000 |
commit | 0ef9c0a2300338e8f1cb5d2a21cc5fb2c98b3374 (patch) | |
tree | e05790dc450ae2ef742a161c05c045299672b6e7 /nova/db | |
parent | 982d459c6583b718c196c82364c569dae63f464e (diff) | |
parent | 6c5dd864c24bc8cec89dccbff68b63c3bc23ef70 (diff) | |
download | nova-0ef9c0a2300338e8f1cb5d2a21cc5fb2c98b3374.tar.gz |
Merge "db: Handle parameters in DB strings"
Diffstat (limited to 'nova/db')
-rw-r--r-- | nova/db/migration.py | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/nova/db/migration.py b/nova/db/migration.py index d3d42e30f6..e06e21a038 100644 --- a/nova/db/migration.py +++ b/nova/db/migration.py @@ -128,10 +128,15 @@ def db_sync(version=None, database='main', context=None): repository = _find_migrate_repo(database) config = _find_alembic_conf(database) - # discard the URL encoded in alembic.ini in favour of the URL configured - # for the engine by the database fixtures, casting from - # 'sqlalchemy.engine.url.URL' to str in the process - config.set_main_option('sqlalchemy.url', str(engine.url)) + # discard the URL stored in alembic.ini in favour of the URL configured + # for the engine, casting from 'sqlalchemy.engine.url.URL' to str in the + # process + # NOTE(sean-k-mooney): the engine has already url encoded the connection + # string using a mix of url encode styles for different parts of the url. + # since we are updating the alembic config parser instance we need to + # escape '%' to '%%' to account for ConfigParser's string interpolation. + url = str(engine.url).replace('%', '%%') + config.set_main_option('sqlalchemy.url', url) # if we're in a deployment where sqlalchemy-migrate is already present, # then apply all the updates for that and fake apply the initial alembic |