Skip to content

Commit 644a74b

Browse files
Balazs Gibizeramoralej
authored andcommitted
Adapt to SQLAlchemy 1.4
This patch makes the necessary change to adapt to the SQLAlchemy 1.4 release in a way that is still compatible with the currently pinned 1.3 versions. This is related to the overall effort to bump SQLAlchemy to 1.4 https://review.opendev.org/c/openstack/requirements/+/788339 CentOS Stream 9 is shipping sqlalchemy 1.4 Co-Authored-By: Mike Bayer <[email protected]> Closes-Bug: #1926426 Change-Id: I8a0ab3b91b4203ab603caac02ee5132be7890e9a (cherry picked from commit 39a6177)
1 parent 288ec4f commit 644a74b

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

nova/cmd/manage.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -706,7 +706,16 @@ def cell0_default_connection():
706706
# worry about parsing and splitting a URL which could have special
707707
# characters in the password, which makes parsing a nightmare.
708708
url = sqla_url.make_url(connection)
709-
url.database = url.database + '_cell0'
709+
710+
# TODO(gibi): remove hasattr() conditional in favor of "url.set()"
711+
# when SQLAlchemy 1.4 is the minimum version in requirements
712+
if hasattr(url, "set"):
713+
url = url.set(database=url.database + '_cell0')
714+
else:
715+
# TODO(zzzeek): remove when SQLAlchemy 1.4
716+
# is the minimum version in requirements
717+
url.database = url.database + '_cell0'
718+
710719
return urlparse.unquote(str(url))
711720

712721
dbc = database_connection or cell0_default_connection()

0 commit comments

Comments
 (0)