From 39a617752f71cb8fe7188baee08b1c2ba48ad066 Mon Sep 17 00:00:00 2001 From: Balazs Gibizer Date: Mon, 3 May 2021 10:44:52 +0200 Subject: [PATCH] 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 Co-Authored-By: Mike Bayer Closes-Bug: #1926426 Change-Id: I8a0ab3b91b4203ab603caac02ee5132be7890e9a --- nova/cmd/manage.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/nova/cmd/manage.py b/nova/cmd/manage.py index 73d2832c8465..732773472960 100644 --- a/nova/cmd/manage.py +++ b/nova/cmd/manage.py @@ -706,7 +706,16 @@ class CellV2Commands(object): # worry about parsing and splitting a URL which could have special # characters in the password, which makes parsing a nightmare. url = sqla_url.make_url(connection) - url.database = url.database + '_cell0' + + # TODO(gibi): remove hasattr() conditional in favor of "url.set()" + # when SQLAlchemy 1.4 is the minimum version in requirements + if hasattr(url, "set"): + url = url.set(database=url.database + '_cell0') + else: + # TODO(zzzeek): remove when SQLAlchemy 1.4 + # is the minimum version in requirements + url.database = url.database + '_cell0' + return urlparse.unquote(str(url)) dbc = database_connection or cell0_default_connection()